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>
impl<'input> Stream<'input>
pub fn new(text: &'input str) -> Self
pub fn from_substr(text: &'input str, fragment: Range<usize>) -> Self
pub fn pos(&self) -> usize
pub fn at_end(&self) -> bool
pub fn curr_byte(&self) -> Result<u8, Error>
pub fn curr_byte_unchecked(&self) -> u8
fn next_byte(&self) -> Result<u8, Error>
pub fn advance(&mut self, n: usize)
fn starts_with(&self, text: &[u8]) -> bool
fn consume_byte(&mut self, c: u8) -> Result<(), Error>
fn try_consume_byte(&mut self, c: u8) -> bool
fn skip_string(&mut self, text: &'static [u8]) -> Result<(), Error>
fn consume_bytes<F: Fn(u8) -> bool>(&mut self, f: F) -> &'input str
fn skip_bytes<F: Fn(u8) -> bool>(&mut self, f: F)
fn consume_chars<F>(&mut self, f: F) -> Result<&'input str, Error>
fn skip_chars<F>(&mut self, f: F) -> Result<(), Error>
fn chars(&self) -> Chars<'input>
fn slice_back(&self, pos: usize) -> &'input str
fn slice_back_span(&self, pos: usize) -> StrSpan<'input>
fn range_from(&self, start: usize) -> Range<usize>
fn skip_spaces(&mut self)
fn starts_with_space(&self) -> bool
fn consume_spaces(&mut self) -> Result<(), Error>
Sourcepub fn try_consume_reference(&mut self) -> Option<Reference<'input>>
pub fn try_consume_reference(&mut self) -> Option<Reference<'input>>
Consumes according to: https://www.w3.org/TR/xml/#NT-Reference
fn consume_reference(&mut self) -> Option<Reference<'input>>
Sourcefn consume_name(&mut self) -> Result<&'input str, Error>
fn consume_name(&mut self) -> Result<&'input str, Error>
Consumes according to: https://www.w3.org/TR/xml/#NT-Name
Sourcefn skip_name(&mut self) -> Result<(), Error>
fn skip_name(&mut self) -> Result<(), Error>
The same as consume_name()
, but does not return a consumed name.
Sourcefn consume_qname(&mut self) -> Result<(&'input str, &'input str), Error>
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
fn consume_eq(&mut self) -> Result<(), Error>
fn consume_quote(&mut self) -> Result<u8, Error>
Sourcepub fn gen_text_pos(&self) -> TextPos
pub fn gen_text_pos(&self) -> TextPos
Calculates a current absolute position.
This operation is very expensive. Use only for errors.
Sourcepub fn gen_text_pos_from(&self, pos: usize) -> TextPos
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.
fn calc_curr_row(text: &str, end: usize) -> u32
fn calc_curr_col(text: &str, end: usize) -> u32
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more