pub struct Channel<T: ?Sized + 'static> { /* private fields */ }Expand description
Implements a message channel through the Fuchsia Driver Runtime
Implementations§
Source§impl<T: ?Sized + 'static> Channel<T>
impl<T: ?Sized + 'static> Channel<T>
Sourcepub fn create() -> (Self, Self)
pub fn create() -> (Self, Self)
Creates a new channel pair that can be used to send messages of type T
between threads managed by the driver runtime.
Sourcepub fn driver_handle(&self) -> &DriverHandle
pub fn driver_handle(&self) -> &DriverHandle
Returns a reference to the inner handle of the channel.
Sourcepub fn into_driver_handle(self) -> DriverHandle
pub fn into_driver_handle(self) -> DriverHandle
Takes the inner handle to the channel. The caller is responsible for ensuring that the handle is freed.
§Panics
This function will panic if the channel has previously had a read wait registered on it.
Sourcepub unsafe fn from_driver_handle(handle: DriverHandle) -> Self
pub unsafe fn from_driver_handle(handle: DriverHandle) -> Self
Initializes a Channel object from the given DriverHandle,
assuming that it is a channel of type T.
§Safety
The caller must ensure that the handle is a Channel-based handle that is
using type T as its wire format.
Sourcepub fn write(&self, message: Message<T>) -> Result<(), Status>
pub fn write(&self, message: Message<T>) -> Result<(), Status>
Writes the Message given to the channel. This will complete asynchronously and can’t
be cancelled.
The channel will take ownership of the data and handles passed in,
Sourcepub fn write_with<F>(&self, arena: Arena, f: F) -> Result<(), Status>
pub fn write_with<F>(&self, arena: Arena, f: F) -> Result<(), Status>
Shorthand for calling Self::write with the result of Message::new_with
Sourcepub fn write_with_data<F>(&self, arena: Arena, f: F) -> Result<(), Status>
pub fn write_with_data<F>(&self, arena: Arena, f: F) -> Result<(), Status>
Shorthand for calling Self::write with the result of Message::new_with