Skip to main content

SpscReceiver

Struct SpscReceiver 

Source
pub struct SpscReceiver<T> { /* private fields */ }
Expand description

Receiver half of SPSC channel.

The single-consumer half of the pair, !Sync for the same reason as SpscSender — two shared receivers would assume_init_read one slot twice, moving out of it and then dropping it twice.

Implementations§

Source§

impl<T> SpscReceiver<T>
where T: Send,

Source

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

Receive a value from the channel, blocking until one arrives.

Source

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

Try to receive a value without blocking.

Trait Implementations§

Source§

impl<T> Consumer<T> for SpscReceiver<T>
where T: Send,

Source§

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

Receive a value, blocking until one arrives.
Source§

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

Receive a value, or report ChannelError::Empty rather than waiting.
Source§

fn is_empty(&self) -> bool

Whether a receive would have to wait.
Source§

impl<T> Drop for SpscReceiver<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<T> !Freeze for SpscReceiver<T>

§

impl<T> !RefUnwindSafe for SpscReceiver<T>

§

impl<T> !Sync for SpscReceiver<T>

§

impl<T> !UnwindSafe for SpscReceiver<T>

§

impl<T> Send for SpscReceiver<T>
where Arc<SpscChannel<T>>: Send,

§

impl<T> Unpin for SpscReceiver<T>
where Arc<SpscChannel<T>>: Unpin,

§

impl<T> UnsafeUnpin for SpscReceiver<T>
where Arc<SpscChannel<T>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.