pub struct InfallibleIteratorReadWords<Iter: Iterator> { /* private fields */ }Expand description
Adapter that turns an iterator over Word into a data source.
Wraps an iterator over Word and implements ReadWords<Word, S, ReadError=Infallible> by pulling the iterator each time a client reads from
it. If the iterator implements ExactSizeIterator then this wrapper also implements
BoundedReadWords.
Implements ReadWord for arbitrary Semantics. This is legal since it doesn’t
implement WriteWords, so the question how reads relate to writes is moot.
See also FallibleIteratorReadWords, and module-level documentation for a
detailed usage example.
Implementations§
source§impl<Iter: Iterator> InfallibleIteratorReadWords<Iter>
impl<Iter: Iterator> InfallibleIteratorReadWords<Iter>
sourcepub fn new<I, Word, ReadError>(iter: I) -> Self
pub fn new<I, Word, ReadError>(iter: I) -> Self
Creates the adapter for the provided iterator.
The provided iterator iter does not need to be fused (i.e., it may return Some
after the first None even though a ReadWords wouldn’t be allowed to do the
equivalent of that). The adapter calls iter.fuse() to ensure correct behavior.
You can get the (fused) iterator back by calling IntoIterator::into_iter.
Trait Implementations§
source§impl<Iter, S, Word> BoundedReadWords<Word, S> for InfallibleIteratorReadWords<Iter>
impl<Iter, S, Word> BoundedReadWords<Word, S> for InfallibleIteratorReadWords<Iter>
source§impl<Iter: Clone + Iterator> Clone for InfallibleIteratorReadWords<Iter>
impl<Iter: Clone + Iterator> Clone for InfallibleIteratorReadWords<Iter>
source§fn clone(&self) -> InfallibleIteratorReadWords<Iter>
fn clone(&self) -> InfallibleIteratorReadWords<Iter>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<Iter: Iterator> IntoIterator for InfallibleIteratorReadWords<Iter>
impl<Iter: Iterator> IntoIterator for InfallibleIteratorReadWords<Iter>
source§impl<Iter, S, Word> ReadWords<Word, S> for InfallibleIteratorReadWords<Iter>
impl<Iter, S, Word> ReadWords<Word, S> for InfallibleIteratorReadWords<Iter>
Since InfallibleIteratorReadWords doesn’t implement WriteWords, it is allowed to
implement ReadWords for all ReadWriteLogics
§type ReadError = Infallible
type ReadError = Infallible
Infallible. Read moresource§fn read(&mut self) -> Result<Option<Word>, Infallible>
fn read(&mut self) -> Result<Option<Word>, Infallible>
Word from the data source and advances the state of the data source
accordingly (i.e., so that the next read won’t read the same Word again). Read moresource§fn maybe_exhausted(&self) -> bool
fn maybe_exhausted(&self) -> bool
true if the data source could be out of data. Read more