Module panda_pile::sync[][src]

Expand description

Synchronous traits for lazily producing or consuming sequences of arbitrary length, and functions for piping producers into consumers.

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

A BulkConsumer is a Consumer that can consume multiple items at a time.

A BulkProducer is a Producer that can produce multiple items at a time.

A Consumer consumes items one by one.

A Producer produces items one by one.

Functions

The BulkConsumer consumes a non-zero number of items from the provided buffer, and returns how many it has consumed.

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.

Pipes all items from the Producer into the Consumer.

Pipes all items from the BulkProducer into the BulkConsumer via the bulk_consume method.

Pipes all items from the BulkProducer into the BulkConsumer via the bulk_produce method.