[][src]Struct kul_core::text::chunk::premade::PosStr

pub struct PosStr<'s> {
    pub val: &'s str,
    pub pos: StrPos<'s>,
}

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 chars.

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.

impl<'s> TextChunk for PosStr<'s>[src]

type CharsSrcStrm = PosStrIter<'s>

Our chunk::SourceStream type.

impl<'s> Debug for PosStr<'s>[src]

impl<'s1, 's2> From<&'s2 str> for PosStr<'s1> where
    's2: 's1, 
[src]

impl<'s> Copy for PosStr<'s>[src]

impl<'s> Clone for PosStr<'s>[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl<'s> Send for PosStr<'s>

impl<'s> Sync for PosStr<'s>

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]