pub struct Receiver<T: DeserializeOwned, R: Read> { /* private fields */ }
Expand description

The receiving-half of the channel. This is the same as std::sync::mpsc::Receiver, except for a few key differences.

See module-level documentation.

Implementations

Get a handle to the underlying stream

Attempts to read an object from the sender end.

If the underlying data stream is a blocking socket then recv() will block until an object is available.

If the underlying data stream is a non-blocking socket then recv() will return an error with a kind of std::io::ErrorKind::WouldBlock whenever the complete object is not available.

The method returns as follows:

  • Ok(object): The receive operation was successful and an object was returned.
  • Err(error): If error.kind() is std::io::ErrorKind::WouldBlock then no object is currently available, but one might become available in the future (This can only happen when the underlying stream is set to non-blocking mode).
  • Err(error): This is a normal read() error and should be handled appropriately.

Trait Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.