[][src]Trait kul_core::text::chunk::SourceStream

pub trait SourceStream<C>: Iterator<Item = SourceIterItem<C::Pos>> where
    C: TextChunk
{ fn peek(&mut self) -> Option<&Self::Item>;
fn next_accum(&mut self) -> Option<Self::Item>;
fn accum_done(&mut self) -> C; }

Like kul_core::SourceStream, but without DatumAllocator, for TextChunks. Only accumulates within a single chunk, not across multiple chunks, unlike kul_core::SourceStream. iter::Iter as kul_core::SourceStream builds on this.

Required methods

fn peek(&mut self) -> Option<&Self::Item>

Returns a reference to the next item's value without advancing the iterator and without interfering with any pending accumulation.

fn next_accum(&mut self) -> Option<Self::Item>

Get the next item, if any, and add it to a pending, or start a new, accumulation, and return the item.

When there is None next item, any pending accumulation is preserved.

fn accum_done(&mut self) -> C

Take any pending accumulation and return it as a new chunk, or return an empty chunk if there was nothing pending.

The accumulation state is reset to nothing.

Loading content...

Implementors

impl<'s> SourceStream<PosStr<'s>> for PosStrIter<'s>[src]

Enables PosStr to be used as the Chunk type of Text types that implement TextConcat so they can be iterated with kul_core::SourceStream. A chunk::SourceStream can accumulate what it iterates within a single chunk. This simply records and grows a slice, to represent each accumulation, which is zero-copy.

Loading content...