Struct Stream

Source
pub struct Stream<'input> {
    pos: usize,
    end: usize,
    span: StrSpan<'input>,
}

Fields§

§pos: usize§end: usize§span: StrSpan<'input>

Implementations§

Source§

impl<'input> Stream<'input>

Source

pub fn new(text: &'input str) -> Self

Source

pub fn from_substr(text: &'input str, fragment: Range<usize>) -> Self

Source

pub fn pos(&self) -> usize

Source

pub fn at_end(&self) -> bool

Source

pub fn curr_byte(&self) -> Result<u8, Error>

Source

pub fn curr_byte_unchecked(&self) -> u8

Source

fn next_byte(&self) -> Result<u8, Error>

Source

pub fn advance(&mut self, n: usize)

Source

fn starts_with(&self, text: &[u8]) -> bool

Source

fn consume_byte(&mut self, c: u8) -> Result<(), Error>

Source

fn try_consume_byte(&mut self, c: u8) -> bool

Source

fn skip_string(&mut self, text: &'static [u8]) -> Result<(), Error>

Source

fn consume_bytes<F: Fn(u8) -> bool>(&mut self, f: F) -> &'input str

Source

fn skip_bytes<F: Fn(u8) -> bool>(&mut self, f: F)

Source

fn consume_chars<F>(&mut self, f: F) -> Result<&'input str, Error>
where F: Fn(&Stream<'_>, char) -> bool,

Source

fn skip_chars<F>(&mut self, f: F) -> Result<(), Error>
where F: Fn(&Stream<'_>, char) -> bool,

Source

fn chars(&self) -> Chars<'input>

Source

fn slice_back(&self, pos: usize) -> &'input str

Source

fn slice_back_span(&self, pos: usize) -> StrSpan<'input>

Source

fn range_from(&self, start: usize) -> Range<usize>

Source

fn skip_spaces(&mut self)

Source

fn starts_with_space(&self) -> bool

Source

fn consume_spaces(&mut self) -> Result<(), Error>

Source

pub fn try_consume_reference(&mut self) -> Option<Reference<'input>>

Source

fn consume_reference(&mut self) -> Option<Reference<'input>>

Source

fn consume_name(&mut self) -> Result<&'input str, Error>

Consumes according to: https://www.w3.org/TR/xml/#NT-Name

Source

fn skip_name(&mut self) -> Result<(), Error>

The same as consume_name(), but does not return a consumed name.

Source

fn consume_qname(&mut self) -> Result<(&'input str, &'input str), Error>

Consumes a qualified XML name and returns it.

Consumes according to: https://www.w3.org/TR/xml-names/#ns-qualnames

Source

fn consume_eq(&mut self) -> Result<(), Error>

Source

fn consume_quote(&mut self) -> Result<u8, Error>

Source

pub fn gen_text_pos(&self) -> TextPos

Calculates a current absolute position.

This operation is very expensive. Use only for errors.

Source

pub fn gen_text_pos_from(&self, pos: usize) -> TextPos

Calculates an absolute position at pos.

This operation is very expensive. Use only for errors.

Source

fn calc_curr_row(text: &str, end: usize) -> u32

Source

fn calc_curr_col(text: &str, end: usize) -> u32

Trait Implementations§

Source§

impl<'input> Clone for Stream<'input>

Source§

fn clone(&self) -> Stream<'input>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<'input> Freeze for Stream<'input>

§

impl<'input> RefUnwindSafe for Stream<'input>

§

impl<'input> Send for Stream<'input>

§

impl<'input> Sync for Stream<'input>

§

impl<'input> Unpin for Stream<'input>

§

impl<'input> UnwindSafe for Stream<'input>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.