[−][src]Struct kul_core::text::chunk::premade::PosStr
A TextChunk
implementation for borrowed string slices (&str
) that knows
what position in its original source string it is at. This is useful for
zero-copy parsing of in-memory UTF-8 strings.
Note: The comparison traits are not implemented intentionally, because this is intended as a chunk type and comparing those directly shouldn't be done.
Fields
val: &'s str
The represented string slice.
pos: StrPos<'s>
Information about val
's position relative to its original source.
Trait Implementations
impl<'s> TextBase for PosStr<'s>
[src]
type Pos = StrPos<'s>
Positional information used with our chunks and char
s.
fn empty() -> Self
[src]
fn is_empty(&self) -> bool
[src]
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.
fn peek(&mut self) -> Option<&SourceIterItem<StrPos<'s>>>
[src]
fn next_accum(&mut self) -> Option<SourceIterItem<StrPos<'s>>>
[src]
fn accum_done(&mut self) -> PosStr<'s>
[src]
impl<'s> TextChunk for PosStr<'s>
[src]
type CharsSrcStrm = PosStrIter<'s>
Our chunk::SourceStream
type.
fn src_strm(&self) -> Self::CharsSrcStrm
[src]
impl<'s> Debug for PosStr<'s>
[src]
impl<'s1, 's2> From<&'s2 str> for PosStr<'s1> where
's2: 's1,
[src]
's2: 's1,
impl<'s> Copy for PosStr<'s>
[src]
impl<'s> Clone for PosStr<'s>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
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, 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,