[][src]Struct kul_core::text::premade::TextDatumList

pub struct TextDatumList<'d, C, ET> { /* fields omitted */ }

A generic Text implementation for chaining underlying chunks by using a linked list of Datums provided by a DatumAllocator. The chunk type can be any TextChunk. This is useful when heap allocation isn't available (or desired) and a Parser's DatumAllocator is the only available (or desired) dynamic allocator.

It is a TextConcat and so can be used with Parsers as the text type of Datums, where a Parser allocates the same type of Datum as this references as its links.

DatumMutRef is used as the Datum reference type used as the links, because it is the type for allocating Datums from arrays instead of the heap. This effectively restricts the genericity of what Datum types can be used to only being generic over the "extra" type, which is fine because this isn't intended for any other types.

Trait Implementations

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

The Text::Chunk type we are for.

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

type Pos = C::Pos

Positional information used with our chunks and chars.

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

type Chunk = C

The type of underlying chunks used to represent our character sequence.

type IterChunksState = Self

Enables generic flexibility in the internal representation of how chunks are held and chained, while also enabling the borrowing of references to this from the self so that the lifetimes are those of our method calls' borrows of self. Read more

fn from_chunkish<T>(v: T) -> Self where
    T: Into<Self::Chunk>, 
[src]

Make an instance of our Self from anything that can convert into a single chunk of our Chunk type. Read more

fn from_str<'s>(s: &'s str) -> Self where
    Self::Chunk: From<&'s str>, 
[src]

Make an instance of our Self from a &str slice, if our Chunk type can convert from that. Read more

fn eq<O: Text>(&self, other: &O) -> bool[src]

Equality comparison with any other type of Text. Compares the logical sequences of chars. Read more

fn cmp<O: Text>(&self, other: &O) -> Ordering[src]

Ordering comparison with any other type of Text. Compares the logical sequences of chars lexicographically. Read more

fn hash<H: Hasher>(&self, state: &mut H)[src]

Hash the logical sequence of chars. Read more

fn chars(&self) -> Chars<Self>[src]

Construct a new iterator that yields the logical character sequence of the given self. Read more

fn encode_utf8<'b>(&self, buf: &'b mut [u8]) -> Result<&'b str, &'b str>[src]

Encode the logical character sequence of the given self as UTF-8 into the provided byte buffer. If the buffer is large enough to contain all the characters, then return the subslice of the buffer that contains them all, as an Ok. If the buffer is too small, then return the subslice that contains as many as fit (which might be shorter than the provided buffer), as an Err. Read more

Important traits for Iter<'l, TT>
fn iter_chunks(&self) -> Iter<Self>[src]

Construct a new iterator that yields borrows of each of our underlying chunks. Read more

Important traits for Iter<'l, TT>
fn iter(&self) -> Iter<Self>[src]

Construct a new iterator, which is also a [kul_core::SourceStream] if the Self type is also a [TextConcat], that yields the logical character sequence, and their positions, of the given self. Read more

impl<'d, DA, C, ET> TextConcat<DA> for TextDatumList<'d, C, ET> where
    C: TextChunk,
    DA: DatumAllocator<TT = Self, ET = ET, DR = DatumMutRef<'d, Self, ET>>, 
[src]

Enables TextDatumList to be used with Parsers as the produced Datums' text type. This can only be used with Parsers that allocate the same type of Datum that Self uses, which is required by this impl's where bounds.

fn concat(self, other: Self, datum_alloc: &mut DA) -> Result<Self, AllocError>[src]

Link two TextDatumLists to form a single TextDatumList that represents their logical concatenation. Unlike most implementations of TextConcat, this does use the datum_alloc argument to allocate the new Datums that are used as the storage of the nodes of our linked-list approach.

impl<'d, C: Debug, ET: Debug> Debug for TextDatumList<'d, C, ET>[src]

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

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

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

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

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

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

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

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

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

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

Auto Trait Implementations

impl<'d, C, ET> Send for TextDatumList<'d, C, ET> where
    C: Send,
    ET: Send

impl<'d, C, ET> Sync for TextDatumList<'d, C, ET> where
    C: Sync,
    ET: Sync

Blanket Implementations

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]