Module forest_filecoin::utils::stream
source · Functions§
- Decouple stream generation and stream consumption into separate threads, keeping not-yet-consumed elements in a bounded queue. This is similar to
stream::buffered
andsink::buffer
. The key difference is thatpar_buffer
is parallel rather than concurrent and will make use of multiple cores when both the stream and the stream consumer are CPU-bound. Because a new thread is spawned, the stream has to beSync
,Send
and'static
.