[][src]Trait kul_core::text::iter::chunks::State

pub trait State {
    type Chunk: TextChunk;
    fn next(&self) -> Option<(&Self::Chunk, Option<&Self>)>;
}

Enables a Text to supply references to each of its chunks by borrowing them from its associated Text::IterChunksState, which must implement this trait, which is borrowed by calls to the Text methods, which enables the lifetimes to be related for those methods to work.

The implementing type must be able to transition to the next states by borrowing its type from itself. E.g. slices and linked lists can do this.

Associated Types

type Chunk: TextChunk

The Text::Chunk type we are for.

Loading content...

Required methods

fn next(&self) -> Option<(&Self::Chunk, Option<&Self>)>

Return the next chunk and the next state, or return None when finished.

Loading content...

Implementors

impl<C> State for [C] where
    C: TextChunk
[src]

Implementation of State for any generic slice of chunks. Useful for Text types that represent their chunks this way. E.g. TextVec uses this for its Vec representation; or this could be used for some fixed-size array.

type Chunk = C

impl<C, ET, '_> State for TextDatumList<'_, C, ET> where
    C: TextChunk
[src]

Enables iterating the chunks of a TextDatumList, by traversing the linked list of them.

This type is its own iter::chunks::State because the links are contained in it.

type Chunk = C

Loading content...