Receiver

Struct Receiver 

Source
pub struct Receiver<R: Deref<Target = State<Q, F, E>>, Q, F, E> { /* private fields */ }
Expand description

Allows receiving data from the SPSC channel via its BulkProducer implementation.

Implementations§

Source§

impl<R: Deref<Target = State<Q, F, E>>, Q: Queue, F, E> Receiver<R, Q, F, E>

Source

pub fn len(&self) -> usize

Returns the number of items that are currently buffered.

Source

pub fn is_empty(&self) -> bool

Returns whether there are currently no items buffered.

Source

pub fn is_receiver_dropped(&self) -> bool

Returns whether the correponding Sender has been dropped already.

Trait Implementations§

Source§

impl<R: Deref<Target = State<Q, F, E>>, Q: Queue, F, E> BufferedProducer for Receiver<R, Q, F, E>

Source§

async fn slurp(&mut self) -> Result<(), Self::Error>

Asks the producer to prepare some values for yielding. Read more
Source§

impl<R: Deref<Target = State<Q, F, E>>, Q: Queue, F, E> BulkProducer for Receiver<R, Q, F, E>

Source§

async fn expose_items<'a>( &'a mut self, ) -> Result<Either<&'a [Self::Item], Self::Final>, Self::Error>
where Self::Item: 'a,

A low-level method for producing multiple items at a time. If you are only working with producers (rather than implementing them), you will probably want to ignore this method and use BulkProducer::bulk_produce instead. Read more
Source§

async fn consider_produced(&mut self, amount: usize) -> Result<(), Self::Error>

A low-level method for producing multiple items at a time. If you are only working with producers (rather than implementing them), you will probably want to ignore this method and use BulkProducer::bulk_produce instead. Read more
Source§

fn bulk_produce( &mut self, buf: &mut [Self::Item], ) -> impl Future<Output = Result<Either<usize, Self::Final>, Self::Error>>
where Self::Item: Clone,

Produces a non-zero number of items by writing them into a given buffer and returning how many items were produced. Read more
Source§

fn bulk_overwrite_full_slice( &mut self, buf: &mut [Self::Item], ) -> impl Future<Output = Result<(), ProduceAtLeastError<Self::Final, Self::Error>>>
where Self::Item: Clone,

Tries to completely overwrite a slice with items from a bulk producer. Reports an error if the slice could not be overwritten completely. Read more
Source§

impl<R: Debug + Deref<Target = State<Q, F, E>>, Q: Debug, F: Debug, E: Debug> Debug for Receiver<R, Q, F, E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<R: Deref<Target = State<Q, F, E>>, Q, F, E> Drop for Receiver<R, Q, F, E>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<R: Deref<Target = State<Q, F, E>>, Q: Queue, F, E> Producer for Receiver<R, Q, F, E>

Source§

async fn produce( &mut self, ) -> Result<Either<Self::Item, Self::Final>, Self::Error>

Take an item from the buffer queue, waiting for an item to become available (by being consumed by the corresponding Sender) if necessary.

Source§

type Item = <Q as Queue>::Item

The sequence produced by this producer starts with arbitrarily many values of this type.
Source§

type Final = F

The sequence produced by this producer ends with up to one value of this type.
Source§

type Error = E

The type of errors the producer can emit instead of doing its job.
Source§

fn produce_item( &mut self, ) -> impl Future<Output = Result<Self::Item, ProduceAtLeastError<Self::Final, Self::Error>>>

Tries to produce a regular item, and reports an error if the final item was produced instead. Read more
Source§

fn overwrite_full_slice( &mut self, buf: &mut [Self::Item], ) -> impl Future<Output = Result<(), ProduceAtLeastError<Self::Final, Self::Error>>>

Tries to completely overwrite a slice with items from a producer. Reports an error if the slice could not be overwritten completely. Read more

Auto Trait Implementations§

§

impl<R, Q, F, E> Freeze for Receiver<R, Q, F, E>
where R: Freeze,

§

impl<R, Q, F, E> RefUnwindSafe for Receiver<R, Q, F, E>

§

impl<R, Q, F, E> Send for Receiver<R, Q, F, E>
where R: Send, Q: Send, F: Send, E: Send,

§

impl<R, Q, F, E> Sync for Receiver<R, Q, F, E>
where R: Sync, Q: Sync, F: Sync, E: Sync,

§

impl<R, Q, F, E> Unpin for Receiver<R, Q, F, E>
where R: Unpin, Q: Unpin, F: Unpin, E: Unpin,

§

impl<R, Q, F, E> UnwindSafe for Receiver<R, Q, F, E>

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.