Trait ThreadChannel
pub trait ThreadChannel<T>: Send + Sync{
// Required methods
fn send(&self, message: T) -> Result<(), NerveError>;
fn receive(&self) -> Result<T, NerveError>;
fn try_receive(&self) -> Result<Option<T>, NerveError>;
fn is_closed(&self) -> bool;
fn close(&self) -> Result<(), NerveError>;
}Expand description
Thread channel interface
Required Methods§
fn send(&self, message: T) -> Result<(), NerveError>
fn send(&self, message: T) -> Result<(), NerveError>
Send a message through the channel
fn receive(&self) -> Result<T, NerveError>
fn receive(&self) -> Result<T, NerveError>
Receive a message from the channel
fn try_receive(&self) -> Result<Option<T>, NerveError>
fn try_receive(&self) -> Result<Option<T>, NerveError>
Try to receive a message without blocking
fn close(&self) -> Result<(), NerveError>
fn close(&self) -> Result<(), NerveError>
Close the channel