DataChannel

Trait DataChannel 

Source
pub trait DataChannel<T> {
    // Required methods
    fn send(&self, value: T) -> Result<(), Error>;
    fn try_send(&self, value: T) -> Result<(), Error>;
    fn recv(&self) -> Result<T, Error>;
    fn try_recv(&self) -> Result<T, Error>;

    // Provided method
    fn is_alive(&self) -> bool { ... }
}
Expand description

An abstract trait for data channels and hubs

Required Methods§

Source

fn send(&self, value: T) -> Result<(), Error>

Sends a value to the channel

Source

fn try_send(&self, value: T) -> Result<(), Error>

Tries to send a value to the channel (non-blocking)

Source

fn recv(&self) -> Result<T, Error>

Receives a value from the channel

Source

fn try_recv(&self) -> Result<T, Error>

Tries to receive a value from the channel (non-blocking)

Provided Methods§

Source

fn is_alive(&self) -> bool

Returns true if the channel is alive

Implementors§

Source§

impl<T> DataChannel<T> for Client<T>

Source§

impl<T> DataChannel<T> for Hub<T>

Source§

impl<T, S, M, CV> DataChannel<T> for BaseReceiver<T, S, M, CV>
where S: ChannelStorage<T>, M: RawMutex, CV: RawCondvar<RawMutex = M> + RawCondvar,

Source§

impl<T, S, M, CV> DataChannel<T> for BaseSender<T, S, M, CV>
where S: ChannelStorage<T>, M: RawMutex, CV: RawCondvar<RawMutex = M> + RawCondvar,