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§
- Bulk
Consumer - A
BulkConsumeris aConsumerthat can consume multiple items at a time. - Bulk
Producer - A
BulkProduceris aProducerthat can produce multiple items at a time. - Consumer
- A
Consumerconsumes items one by one. - Producer
- A
Producerproduces items one by one.
Functions§
- bulk_
consume - The
BulkConsumerconsumes a non-zero number of items from the provided buffer, and returns how many it has consumed. - bulk_
produce - The
BulkProducerproduces 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
Producerinto theConsumer. - pipe_
bulk_ consume - Pipes all items from the
BulkProducerinto theBulkConsumervia thebulk_consumemethod. - pipe_
bulk_ produce - Pipes all items from the
BulkProducerinto theBulkConsumervia thebulk_producemethod.