Struct crusty_core::prelude::ChReceiver[][src]

pub struct ChReceiver<T> { /* fields omitted */ }
Expand description

The receiving end of a channel.

Note: Cloning the receiver does not turn this channel into a broadcast channel. Each message will only be received by a single receiver. This is useful for implementing work stealing for concurrent programs.

Implementations

impl<T> Receiver<T>[src]

pub fn recv_async(&self) -> RecvFut<'_, T>

Notable traits for RecvFut<'a, T>

impl<'a, T> Future for RecvFut<'a, T> type Output = Result<T, RecvError>;
[src]

Asynchronously receive a value from the channel, returning an error if all senders have been dropped. If the channel is empty, the returned future will yield to the async runtime.

pub fn into_recv_async(self) -> RecvFut<'static, T>

Notable traits for RecvFut<'a, T>

impl<'a, T> Future for RecvFut<'a, T> type Output = Result<T, RecvError>;
[src]

Convert this receiver into a future that asynchronously receives a single message from the channel, returning an error if all senders have been dropped. If the channel is empty, this future will yield to the async runtime.

pub fn stream(&self) -> RecvStream<'_, T>[src]

Create an asynchronous stream that uses this receiver to asynchronously receive messages from the channel. The receiver will continue to be usable after the stream has been dropped.

pub fn into_stream(self) -> RecvStream<'static, T>[src]

Convert this receiver into a stream that allows asynchronously receiving messages from the channel.

impl<T> Receiver<T>[src]

pub fn try_recv(&self) -> Result<T, TryRecvError>[src]

Attempt to fetch an incoming value from the channel associated with this receiver, returning an error if the channel is empty.

pub fn recv(&self) -> Result<T, RecvError>[src]

Wait for an incoming value from the channel associated with this receiver, returning an error if all senders have been dropped.

pub fn recv_deadline(&self, deadline: Instant) -> Result<T, RecvTimeoutError>[src]

Wait for an incoming value from the channel associated with this receiver, returning an error if all senders have been dropped or the deadline has passed.

pub fn recv_timeout(&self, dur: Duration) -> Result<T, RecvTimeoutError>[src]

Wait for an incoming value from the channel associated with this receiver, returning an error if all senders have been dropped or the timeout has expired.

pub fn iter(&self) -> Iter<'_, T>[src]

Create a blocking iterator over the values received on the channel that finishes iteration when all senders have been dropped.

pub fn try_iter(&self) -> TryIter<'_, T>[src]

A non-blocking iterator over the values received on the channel that finishes iteration when all senders have been dropped or the channel is empty.

pub fn drain(&self) -> Drain<'_, T>[src]

Take all msgs currently sitting in the channel and produce an iterator over them. Unlike try_iter, the iterator will not attempt to fetch any more values from the channel once the function has been called.

pub fn is_disconnected(&self) -> bool[src]

Returns true if all senders for this channel have been dropped.

pub fn is_empty(&self) -> bool[src]

Returns true if the channel is empty. Note: Zero-capacity channels are always empty.

pub fn is_full(&self) -> bool[src]

Returns true if the channel is full. Note: Zero-capacity channels are always full.

pub fn len(&self) -> usize[src]

Returns the number of messages in the channel.

pub fn capacity(&self) -> Option<usize>[src]

If the channel is bounded, returns its capacity.

Trait Implementations

impl<T> Clone for Receiver<T>[src]

pub fn clone(&self) -> Receiver<T>[src]

Clone this receiver. Receiver acts as a handle to the ending a channel. Remaining channel contents will only be cleaned up when all senders and the receiver have been dropped.

Note: Cloning the receiver does not turn this channel into a broadcast channel. Each message will only be received by a single receiver. This is useful for implementing work stealing for concurrent programs.

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T> Debug for Receiver<T>[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

impl<T> Drop for Receiver<T>[src]

pub fn drop(&mut self)[src]

Executes the destructor for this type. Read more

impl<'a, T> IntoIterator for &'a Receiver<T>[src]

type Item = T

The type of the elements being iterated over.

type IntoIter = Iter<'a, T>

Which kind of iterator are we turning this into?

pub fn into_iter(self) -> <&'a Receiver<T> as IntoIterator>::IntoIter[src]

Creates an iterator from a value. Read more

impl<T> IntoIterator for Receiver<T>[src]

type Item = T

The type of the elements being iterated over.

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?

pub fn into_iter(self) -> <Receiver<T> as IntoIterator>::IntoIter[src]

Creates an iterator from a value. Read more

Auto Trait Implementations

impl<T> !RefUnwindSafe for Receiver<T>

impl<T> Send for Receiver<T> where
    T: Send

impl<T> Sync for Receiver<T> where
    T: Send

impl<T> Unpin for Receiver<T>

impl<T> !UnwindSafe for Receiver<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>

Notable traits for Instrumented<T>

impl<T> Future for Instrumented<T> where
    T: Future
type Output = <T as Future>::Output;
[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>

Notable traits for Instrumented<T>

impl<T> Future for Instrumented<T> where
    T: Future
type Output = <T as Future>::Output;
[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>

Notable traits for Instrumented<T>

impl<T> Future for Instrumented<T> where
    T: Future
type Output = <T as Future>::Output;
[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>

Notable traits for Instrumented<T>

impl<T> Future for Instrumented<T> where
    T: Future
type Output = <T as Future>::Output;
[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V

impl<T> WithSubscriber for T[src]

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>

Notable traits for WithDispatch<T>

impl<T> Future for WithDispatch<T> where
    T: Future
type Output = <T as Future>::Output;
where
    S: Into<Dispatch>, 
[src]

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

fn with_current_subscriber(self) -> WithDispatch<Self>

Notable traits for WithDispatch<T>

impl<T> Future for WithDispatch<T> where
    T: Future
type Output = <T as Future>::Output;
[src]

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more

impl<T> JobStateValues for T where
    T: 'static + Send + Sync + Clone
[src]