pub struct Handle<M: Message> { /* private fields */ }Expand description
Provides bidirectional communication with a reactor. If this is dropped the reactor stops.
Implementations§
Source§impl<M: Message> Handle<M>
impl<M: Message> Handle<M>
Sourcepub fn send(&self, command: Command<M>) -> Result<()>
pub fn send(&self, command: Command<M>) -> Result<()>
Sends a command to a reactor associated with this handle. If this produces an IO error, it means the reactor is irrecoverable and should be discarded. This method never blocks so it is appropriate for use in async contexts.
Sourcepub fn receive_blocking(&self) -> Result<Event<M>>
pub fn receive_blocking(&self) -> Result<Event<M>>
Blocks until the reactor associated with this handle produces a message. If an IO error is
produced, the reactor is irrecoverable and should be discarded. While this method is
available in async contexts, it should not be used there. Use receiver() to get a
raw handle on the receiver for use in async scenarios or where extra API surfaces are required.
Sourcepub fn receiver(&self) -> &Receiver<Event<M>>
pub fn receiver(&self) -> &Receiver<Event<M>>
Exposes the receive portion of the handle. The receiver could be of a blocking or async variety, depending on which feature is active.