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.
Implementations
sourceimpl<T: DeserializeOwned, R: Read> Receiver<T, R>
impl<T: DeserializeOwned, R: Read> Receiver<T, R>
sourcepub fn inner(&self) -> MutexGuard<'_, R>
pub fn inner(&self) -> MutexGuard<'_, R>
Get a handle to the underlying stream
sourcepub fn recv(&mut self) -> Result<T>
pub fn recv(&mut self) -> Result<T>
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): Iferror.kind()isstd::io::ErrorKind::WouldBlockthen 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 normalread()error and should be handled appropriately.
Trait Implementations
impl<T: DeserializeOwned, R: Read> Send for Receiver<T, R>
Auto Trait Implementations
impl<T, R> RefUnwindSafe for Receiver<T, R> where
T: RefUnwindSafe,
impl<T, R> Sync for Receiver<T, R> where
R: Send,
T: Sync,
impl<T, R> Unpin for Receiver<T, R> where
T: Unpin,
impl<T, R> UnwindSafe for Receiver<T, R> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more