pub struct CFMessagePort(/* private fields */);Expand description
Safe wrapper around a retained Core Foundation CFMessagePort reference.
Implementations§
Source§impl CFMessagePort
impl CFMessagePort
Sourcepub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self>
pub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self>
Adopts a +1 retained CFMessagePort pointer and returns None for null.
§Safety
A non-null ptr must be a live CFMessagePort pointer of the exact dynamic type carrying one retain transferred to this wrapper. The caller must not release or separately adopt that transferred retain.
Sourcepub unsafe fn from_raw_borrowed(ptr: *mut c_void) -> Option<Self>
pub unsafe fn from_raw_borrowed(ptr: *mut c_void) -> Option<Self>
Retains a +0 borrowed CFMessagePort pointer and returns an owned wrapper.
§Safety
A non-null ptr must be a live CFMessagePort pointer of the exact dynamic type for the duration of the retain call.
Sourcepub const fn as_ptr(&self) -> *mut c_void
pub const fn as_ptr(&self) -> *mut c_void
Borrows the raw +0 Core Foundation pointer while self remains alive.
Sourcepub fn into_cf_type(self) -> CFType
pub fn into_cf_type(self) -> CFType
Consumes this wrapper and returns the erased CFType.
Source§impl CFMessagePort
impl CFMessagePort
Sourcepub fn create_echo_local(name: &str) -> Self
pub fn create_echo_local(name: &str) -> Self
Create a local message port that echoes request data back as the reply.
Sourcepub fn connect_remote(name: &str) -> Option<Self>
pub fn connect_remote(name: &str) -> Option<Self>
Connect to an existing remote message port.
Sourcepub fn send_request(
&self,
bytes: &[u8],
timeout: Duration,
) -> Result<Vec<u8>, i32>
pub fn send_request( &self, bytes: &[u8], timeout: Duration, ) -> Result<Vec<u8>, i32>
Send a request and copy the reply bytes.
Sourcepub fn invalidate(&self)
pub fn invalidate(&self)
Invalidate the message port.
Trait Implementations§
Source§impl AsCFType for CFMessagePort
impl AsCFType for CFMessagePort
Source§impl Clone for CFMessagePort
impl Clone for CFMessagePort
Source§fn clone(&self) -> CFMessagePort
fn clone(&self) -> CFMessagePort
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more