[][src]Trait dialectic::backend::Receive

pub trait Receive<T> {
    type Error;
    pub fn recv<'async_lifetime>(
        &'async_lifetime mut self
    ) -> Pin<Box<dyn Future<Output = Result<T, Self::Error>> + Send + 'async_lifetime>>; }

If a transport is Receive<T>, we can use it to recv a message of type T.

In order to support the Chan::offer method, all backends must implement Receive<Choice<N>>, in addition to whatever other types they support. For more information, see Choice.

Examples

For an example of implementing Receive, check out the source for the implementation of Receive for mpsc::Receiver.

Associated Types

type Error[src]

The type of possible errors when receiving.

Loading content...

Required methods

pub fn recv<'async_lifetime>(
    &'async_lifetime mut self
) -> Pin<Box<dyn Future<Output = Result<T, Self::Error>> + Send + 'async_lifetime>>
[src]

Receive a message. This may require type annotations for disambiguation.

Loading content...

Implementors

impl<'a, T: Send + Any> Receive<T> for dialectic::backend::mpsc::Receiver<'a>[src]

This is supported on crate feature mpsc only.

type Error = RecvError

impl<'a, T: Send + Any> Receive<T> for UnboundedReceiver<'a>[src]

This is supported on crate feature mpsc only.

type Error = RecvError

impl<T, C> Receive<T> for Available<C> where
    C: Receive<T>, 
[src]

type Error = C::Error

impl<T, F, D, R> Receive<T> for dialectic::backend::serde::Receiver<F, D, R> where
    T: for<'a> Deserialize<'a>,
    F: Deserializer<D::Item> + Unpin + Send,
    D: Decoder + Send,
    R: AsyncRead + Unpin + Send
[src]

This is supported on crate feature serde only.

type Error = RecvError<F, D>

Loading content...