MCPcopy Create free account
hub / github.com/NfNitLoop/pipeliner / SharedIterator

Class SharedIterator

src/unordered.rs:148–153  ·  view source on GitHub ↗

An iterator which can be safely shared between threads.

Source from the content-addressed store, hash-verified

146
147/// An iterator which can be safely shared between threads.
148struct SharedIterator<I: Iterator> {
149 // Since we're going to be sharing among multiple threads, each thread will
150 // need to get a None of its own to know we've reached the end of the input.
151 // For that, we use a Fused iterator here:
152 iterator: Arc<Mutex<std::iter::Fuse<I>>>,
153}
154
155impl<I: Iterator> SharedIterator<I> {
156 fn wrap(iterator: I) -> Self {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected