[−][src]Struct kul_core::text::premade::TextDatumList
A generic Text
implementation for chaining underlying chunks by using a
linked list of Datum
s 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 Parser
s as the text type of
Datum
s, 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 Datum
s 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]
C: TextChunk,
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.
fn next(&self) -> Option<(&Self::Chunk, Option<&Self>)>
[src]
impl<C, ET, '_> TextBase for TextDatumList<'_, C, ET> where
C: TextChunk,
[src]
C: TextChunk,
type Pos = C::Pos
Positional information used with our chunks and char
s.
fn empty() -> Self
[src]
fn is_empty(&self) -> bool
[src]
impl<C, ET, '_> Text for TextDatumList<'_, C, ET> where
C: TextChunk,
[src]
C: TextChunk,
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 iter_chunks_state(&self) -> Option<&Self::IterChunksState>
[src]
fn from_chunkish<T>(v: T) -> Self where
T: Into<Self::Chunk>,
[src]
T: Into<Self::Chunk>,
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]
Self::Chunk: From<&'s str>,
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 char
s. Read more
fn cmp<O: Text>(&self, other: &O) -> Ordering
[src]
Ordering comparison with any other type of Text
. Compares the logical sequences of char
s lexicographically. Read more
fn hash<H: Hasher>(&self, state: &mut H)
[src]
Hash the logical sequence of char
s. 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]
C: TextChunk,
DA: DatumAllocator<TT = Self, ET = ET, DR = DatumMutRef<'d, Self, ET>>,
Enables TextDatumList
to be used with Parser
s as the produced Datum
s'
text type. This can only be used with Parser
s 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 TextDatumList
s 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 Datum
s 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]
TT: Text,
C: TextChunk,
fn eq(&self, other: &TT) -> bool
[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]
C: TextChunk,
impl<C, ET, '_> Ord for TextDatumList<'_, C, ET> where
C: TextChunk,
[src]
C: TextChunk,
fn cmp(&self, other: &Self) -> Ordering
[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]
TT: Text,
C: TextChunk,
fn partial_cmp(&self, other: &TT) -> Option<Ordering>
[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, '_> Hash for TextDatumList<'_, C, ET> where
C: TextChunk,
[src]
C: TextChunk,
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<C, ET, '_> From<C> for TextDatumList<'_, C, ET> where
C: TextChunk,
[src]
C: TextChunk,
Auto Trait Implementations
impl<'d, C, ET> Send for TextDatumList<'d, C, ET> where
C: Send,
ET: Send,
C: Send,
ET: Send,
impl<'d, C, ET> Sync for TextDatumList<'d, C, ET> where
C: Sync,
ET: Sync,
C: Sync,
ET: Sync,
Blanket Implementations
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> From for T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,