An iterator which can be safely shared between threads.
| 146 | |
| 147 | /// An iterator which can be safely shared between threads. |
| 148 | struct 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 | |
| 155 | impl<I: Iterator> SharedIterator<I> { |
| 156 | fn wrap(iterator: I) -> Self { |
nothing calls this directly
no outgoing calls
no test coverage detected