pub struct Stream<'a> {
text: &'a str,
pos: usize,
}
Expand description
A streaming text parsing interface.
Fields§
§text: &'a str
§pos: usize
Implementations§
Source§impl Stream<'_>
impl Stream<'_>
Sourcepub fn parse_number(&mut self) -> Result<f32, Error>
pub fn parse_number(&mut self) -> Result<f32, Error>
Parses number from the stream.
This method will detect a number length and then
will pass a substring to the f64::from_str
method.
fn parse_number_impl(&mut self) -> Result<f32, Error>
Sourcepub fn parse_list_number(&mut self) -> Result<f32, Error>
pub fn parse_list_number(&mut self) -> Result<f32, Error>
Parses number from a list of numbers.
Source§impl<'a> Stream<'a>
impl<'a> Stream<'a>
Sourcepub fn jump_to_end(&mut self)
pub fn jump_to_end(&mut self)
Sets current position equal to the end.
Used to indicate end of parsing on error.
Sourcepub fn at_end(&self) -> bool
pub fn at_end(&self) -> bool
Checks if the stream is reached the end.
Any pos()
value larger than original text length indicates stream end.
Accessing stream after reaching end via safe methods will produce an error.
Accessing stream after reaching end via *_unchecked methods will produce a Rust’s bound checking error.
Sourcepub fn curr_byte_unchecked(&self) -> u8
pub fn curr_byte_unchecked(&self) -> u8
Returns a byte from a current stream position.
§Panics
- if the current position is after the end of the data
Sourcepub fn is_curr_byte_eq(&self, c: u8) -> bool
pub fn is_curr_byte_eq(&self, c: u8) -> bool
Checks that current byte is equal to provided.
Returns false
if no bytes left.
Sourcepub fn next_byte(&self) -> Result<u8, Error>
pub fn next_byte(&self) -> Result<u8, Error>
Returns a next byte from a current stream position.
Sourcepub fn skip_spaces(&mut self)
pub fn skip_spaces(&mut self)
Skips whitespaces.
Accepted values: ' ' \n \r \t
.
Sourcepub fn skip_bytes<F>(&mut self, f: F)
pub fn skip_bytes<F>(&mut self, f: F)
Consumes bytes by the predicate.
Sourcepub fn slice_back(&self, pos: usize) -> &'a str
pub fn slice_back(&self, pos: usize) -> &'a str
Slices data from pos
to the current position.
Sourcepub fn skip_digits(&mut self)
pub fn skip_digits(&mut self)
Skips digits.
pub(crate) fn parse_list_separator(&mut self)
pub(crate) fn parse_flag(&mut self) -> Result<bool, Error>
Trait Implementations§
impl<'a> Copy for Stream<'a>
impl<'a> Eq for Stream<'a>
impl<'a> StructuralPartialEq for Stream<'a>
Auto Trait Implementations§
impl<'a> Freeze for Stream<'a>
impl<'a> RefUnwindSafe for Stream<'a>
impl<'a> Send for Stream<'a>
impl<'a> Sync for Stream<'a>
impl<'a> Unpin for Stream<'a>
impl<'a> UnwindSafe for Stream<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more