Trait ThreadChannel

pub trait ThreadChannel<T>: Send + Sync
where 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>

Send a message through the channel

fn receive(&self) -> Result<T, NerveError>

Receive a message from the channel

fn try_receive(&self) -> Result<Option<T>, NerveError>

Try to receive a message without blocking

fn is_closed(&self) -> bool

Check if channel is closed

fn close(&self) -> Result<(), NerveError>

Close the channel

Implementors§