Struct fuchsia_async::EHandle
source · pub struct EHandle { /* private fields */ }
Expand description
A handle to an executor.
Implementations§
source§impl EHandle
impl EHandle
sourcepub fn local() -> Self
pub fn local() -> Self
Returns the thread-local executor.
§Panics
If called outside the context of an active async executor.
sourcepub fn port(&self) -> &Port
pub fn port(&self) -> &Port
Get a reference to the Fuchsia zx::Port
being used to listen for events.
sourcepub fn register_receiver<T>(&self, receiver: Arc<T>) -> ReceiverRegistration<T>where
T: PacketReceiver,
pub fn register_receiver<T>(&self, receiver: Arc<T>) -> ReceiverRegistration<T>where
T: PacketReceiver,
Registers a PacketReceiver
with the executor and returns a registration.
The PacketReceiver
will be deregistered when the Registration
is dropped.
sourcepub fn spawn_detached(&self, future: impl Future<Output = ()> + Send + 'static)
pub fn spawn_detached(&self, future: impl Future<Output = ()> + Send + 'static)
Spawn a new task to be run on this executor.
Tasks spawned using this method must be thread-safe (implement the Send
trait), as they
may be run on either a singlethreaded or multithreaded executor.
sourcepub fn spawn_local_detached(&self, future: impl Future<Output = ()> + 'static)
pub fn spawn_local_detached(&self, future: impl Future<Output = ()> + 'static)
Spawn a new task to be run on this executor.
This is similar to the spawn_detached
method, but tasks spawned using this method do not
have to be threads-safe (implement the Send
trait). In return, this method requires that
this executor is a LocalExecutor.