Struct constriction::backends::FallibleIteratorReadWords
source · pub struct FallibleIteratorReadWords<Iter: Iterator> { /* private fields */ }
Expand description
Adapter that turns an iterator over Result<Word, ReadError>
into a data source.
Wraps an iterator over Result<Word, ReadError>
and implements ReadWords<Word, S, ReadError=ReadError>
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 InfallibleIteratorReadWords
, and module-level documentation for a
detailed usage example.
Implementations§
source§impl<Iter: Iterator> FallibleIteratorReadWords<Iter>
impl<Iter: Iterator> FallibleIteratorReadWords<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 FallibleIteratorReadWords<Iter>
impl<Iter, S, Word> BoundedReadWords<Word, S> for FallibleIteratorReadWords<Iter>
source§impl<Iter: Clone + Iterator> Clone for FallibleIteratorReadWords<Iter>
impl<Iter: Clone + Iterator> Clone for FallibleIteratorReadWords<Iter>
source§fn clone(&self) -> FallibleIteratorReadWords<Iter>
fn clone(&self) -> FallibleIteratorReadWords<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 FallibleIteratorReadWords<Iter>
impl<Iter: Iterator> IntoIterator for FallibleIteratorReadWords<Iter>
source§impl<Iter, S, Word, ReadError> ReadWords<Word, S> for FallibleIteratorReadWords<Iter>
impl<Iter, S, Word, ReadError> ReadWords<Word, S> for FallibleIteratorReadWords<Iter>
Since FallibleIteratorReadWords
doesn’t implement WriteWords
, it is allowed to
implement ReadWords
for all ReadWriteLogic
s
source§type ReadError = ReadError
type ReadError = ReadError
Infallible
. Read moresource§fn read(&mut self) -> Result<Option<Word>, Self::ReadError>
fn read(&mut self) -> Result<Option<Word>, Self::ReadError>
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 moreAuto Trait Implementations§
impl<Iter> Freeze for FallibleIteratorReadWords<Iter>where
Iter: Freeze,
impl<Iter> RefUnwindSafe for FallibleIteratorReadWords<Iter>where
Iter: RefUnwindSafe,
impl<Iter> Send for FallibleIteratorReadWords<Iter>where
Iter: Send,
impl<Iter> Sync for FallibleIteratorReadWords<Iter>where
Iter: Sync,
impl<Iter> Unpin for FallibleIteratorReadWords<Iter>where
Iter: Unpin,
impl<Iter> UnwindSafe for FallibleIteratorReadWords<Iter>where
Iter: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)