diff --git a/src/lib.rs b/src/lib.rs index 855864a02..80eab2685 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -428,6 +428,18 @@ impl Context { } } + /// Create a context from a raw pointer + pub unsafe fn from_raw(raw_ctx: *mut c_void) -> Context { + Context { + raw: Arc::new(RawContext { ctx: raw_ctx }), + } + } + + /// Get the raw pointer to the context + pub fn into_raw(self) -> *mut c_void { + self.raw.ctx + } + /// Create a new socket. /// /// Note that the returned socket keeps a an `Arc` reference to