Struct constriction::backends::FallibleIteratorReadWords [−][src]
pub struct FallibleIteratorReadWords<Iter: Iterator> { /* fields omitted */ }
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
impl<Iter: Iterator> FallibleIteratorReadWords<Iter>[src]
impl<Iter: Iterator> FallibleIteratorReadWords<Iter>[src]pub fn new<I, Word, ReadError>(iter: I) -> Self where
I: IntoIterator<IntoIter = Iter>,
Iter: Iterator<Item = Result<Word, ReadError>>, [src]
pub fn new<I, Word, ReadError>(iter: I) -> Self where
I: IntoIterator<IntoIter = Iter>,
Iter: Iterator<Item = Result<Word, ReadError>>, [src]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
impl<Iter, S, Word> BoundedReadWords<Word, S> for FallibleIteratorReadWords<Iter> where
Self: ReadWords<Word, S>,
Iter: ExactSizeIterator,
S: Semantics, [src]
impl<Iter, S, Word> BoundedReadWords<Word, S> for FallibleIteratorReadWords<Iter> where
Self: ReadWords<Word, S>,
Iter: ExactSizeIterator,
S: Semantics, [src]impl<Iter: Clone + Iterator> Clone for FallibleIteratorReadWords<Iter>[src]
impl<Iter: Clone + Iterator> Clone for FallibleIteratorReadWords<Iter>[src]fn clone(&self) -> FallibleIteratorReadWords<Iter>[src]
fn clone(&self) -> FallibleIteratorReadWords<Iter>[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]Performs copy-assignment from source. Read more
impl<Iter: Debug + Iterator> Debug for FallibleIteratorReadWords<Iter>[src]
impl<Iter: Debug + Iterator> Debug for FallibleIteratorReadWords<Iter>[src]impl<Iter: Iterator> IntoIterator for FallibleIteratorReadWords<Iter>[src]
impl<Iter: Iterator> IntoIterator for FallibleIteratorReadWords<Iter>[src]impl<Iter, S, Word, ReadError> ReadWords<Word, S> for FallibleIteratorReadWords<Iter> where
Iter: Iterator<Item = Result<Word, ReadError>>,
S: Semantics,
ReadError: Debug, [src]
impl<Iter, S, Word, ReadError> ReadWords<Word, S> for FallibleIteratorReadWords<Iter> where
Iter: Iterator<Item = Result<Word, ReadError>>,
S: Semantics,
ReadError: Debug, [src]Since FallibleIteratorReadWords doesn’t implement WriteWords, it is allowed to
implement ReadWords for all ReadWriteLogics
type ReadError = ReadError
type ReadError = ReadErrorThe error type that can occur when reading from the data source, or Infallible. Read more
fn read(&mut self) -> Result<Option<Word>, Self::ReadError>[src]
fn read(&mut self) -> Result<Option<Word>, Self::ReadError>[src]Reads a single 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 more
fn maybe_exhausted(&self) -> bool[src]
fn maybe_exhausted(&self) -> bool[src]Returns true if the data source could be out of data. Read more
Auto Trait Implementations
impl<Iter> RefUnwindSafe for FallibleIteratorReadWords<Iter> where
Iter: RefUnwindSafe,
Iter: RefUnwindSafe,
impl<Iter> Send for FallibleIteratorReadWords<Iter> where
Iter: Send,
Iter: Send,
impl<Iter> Sync for FallibleIteratorReadWords<Iter> where
Iter: Sync,
Iter: Sync,
impl<Iter> Unpin for FallibleIteratorReadWords<Iter> where
Iter: Unpin,
Iter: Unpin,
impl<Iter> UnwindSafe for FallibleIteratorReadWords<Iter> where
Iter: UnwindSafe,
Iter: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn to_owned(&self) -> T[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
pub fn clone_into(&self, target: &mut T)[src]🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more