Module nb_send

Module nb_send 

Source
Expand description

Nonblocking, threadsafe traits for lazily producing or consuming sequences of arbitrary length, and functions for piping producers into consumers. All asynchronous APIs are derived from the corresponding synchronous APIs through the process described in the crate documentation. These APIs are identical to those in the nb module, except that all associated futures are required to be Send and can thus be scheduled on a multithreaded event loop.

A Producer emits a sequence one item at a time, a generalized and buffered variation on the core::iter::Iterator trait. A BulkProducer extends those capabilities with the option of producing multiple items at a time, yielding a generalized std::io::Read abstraction.

Dually, a Consumer processes a sequence one item at a time. A BulkConsumer can further process multiple items at a time, yielding a generalized std::io::Write abstraction.

Traits§

BulkConsumer
A BulkConsumer is a Consumer that can consume multiple items at a time.
BulkProducer
A BulkProducer is a Producer that can produce multiple items at a time.
Consumer
A Consumer consumes items one by one.
Producer
A Producer produces items one by one.

Functions§

bulk_consume
The BulkConsumer consumes a non-zero number of items from the provided buffer, and returns how many it has consumed.
bulk_produce
The BulkProducer produces a non-zero number of items into the provided buffer, and returns how many it has produced. The memory in the buffer does not need to be initialized.
pipe
Pipes all items from the Producer into the Consumer.
pipe_bulk_consume
Pipes all items from the BulkProducer into the BulkConsumer via the bulk_consume method.
pipe_bulk_produce
Pipes all items from the BulkProducer into the BulkConsumer via the bulk_produce method.