Struct flume::Receiver[][src]

pub struct Receiver<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

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.

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.

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.

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

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

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

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.

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.

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

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.

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.

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

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

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

Returns the number of messages in the channel.

If the channel is bounded, returns its capacity.

Trait Implementations

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.

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

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

recently added

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

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.