pub trait BoundedReadWords<Word, S: Semantics>: ReadWords<Word, S> {
    // Required method
    fn remaining(&self) -> usize;

    // Provided method
    fn is_exhausted(&self) -> bool { ... }
}
Expand description

A trait for data sources that know how much data is left.

Required Methods§

source

fn remaining(&self) -> usize

Returns the number of Words that are left for reading.

If remaining() returns n then the next n calls to read must not return Ok(None), and any subsequent reads must not return Ok(Some(_)).

Provided Methods§

source

fn is_exhausted(&self) -> bool

Whether or not there is no data left to read.

You’ll usually want to overwrite the default implementation of ReadWords::maybe_exhausted to call is_exhausted, although the only strict requirement is that maybe_exhausted must not return false if is_exhausted returns true.

Implementations on Foreign Types§

source§

impl<Array> BoundedReadWords<<Array as Array>::Item, Stack> for SmallVec<Array>
where Array: Array,

source§

impl<Word> BoundedReadWords<Word, Stack> for Vec<Word>

Implementors§

source§

impl<Iter, S, Word> BoundedReadWords<Word, S> for FallibleIteratorReadWords<Iter>
where Self: ReadWords<Word, S>, Iter: ExactSizeIterator, S: Semantics,

source§

impl<Iter, S, Word> BoundedReadWords<Word, S> for InfallibleIteratorReadWords<Iter>
where Self: ReadWords<Word, S>, Iter: ExactSizeIterator, S: Semantics,

source§

impl<Word, B: BoundedReadWords<Word, Queue>> BoundedReadWords<Word, Stack> for Reverse<B>

source§

impl<Word, B: BoundedReadWords<Word, Stack>> BoundedReadWords<Word, Queue> for Reverse<B>

source§

impl<Word: Clone, Buf: AsRef<[Word]>> BoundedReadWords<Word, Queue> for Cursor<Word, Buf>

source§

impl<Word: Clone, Buf: SafeBuf<Word>> BoundedReadWords<Word, Stack> for Cursor<Word, Buf>