Struct sn::Stream [−][src]
A data stream. Used by the Parser to iterate over the supplied JSON data and to parse it into Values.
Implementations
impl<'a, T: Copy> Stream<'a, T>
[src]
pub fn current_copied(&self) -> Option<T>
[src]
Returns the current character.
pub fn current_unchecked(&self) -> T
[src]
Returns the current element and panicks if it’s out of range
pub fn next_copied(&mut self) -> Option<T>
[src]
Moves to the next character and returns it.
pub fn peek_back_copied(&self) -> Option<T>
[src]
Returns a reference to the perevious entry in the stream
impl<'a, T: Eq + Copy> Stream<'a, T>
[src]
pub fn next_if_current_is(&mut self, expect: T) -> Option<T>
[src]
Returns the current character and moves to the next character if the character matches the provided input.
pub fn next_if_current_present_in(&mut self, expect: &[T]) -> Option<T>
[src]
Returns the current character and moves to the next character if the character exists in the provided array.
pub fn skip_if_current_is(&mut self, expect: T) -> bool
[src]
Skips the current character if it matches the input, and returns true in this case. Returns false and does not skip if the current character does not match the input.
impl<'a, T> Stream<'a, T>
[src]
pub fn new(data: &'a [T]) -> Stream<'_, T>
[src]
Creates a new stream
pub fn current(&self) -> Option<&T>
[src]
Returns the current element
pub fn is_eof(&self) -> bool
[src]
Checks whether the stream has reached the end
pub fn length(&self) -> usize
[src]
Get the length of the stream.
pub fn next_entry(&mut self) -> Option<&T>
[src]
Returns the next element
pub fn next_unchecked(&mut self) -> &T
[src]
Returns the next element and panicks if it’s out of bounds
pub fn peek(&self) -> Option<&T>
[src]
Returns a reference to the next entry in the stream
pub fn peek_back(&self) -> Option<&T>
[src]
Returns a reference to the previous entry in the stream
pub fn position(&self) -> usize
[src]
The current position of the stream on the data
pub fn skip(&mut self)
[src]
Skips the current character and moves on to the next one
pub fn skip_n(&mut self, n: usize)
[src]
Skips n amount of characters
pub fn unskip(&mut self)
[src]
Moves back to the previous character
pub fn slice(&self, from: usize, to: usize) -> &'a [T]
[src]
Returns a subslice of this stream but also checks stream length to prevent out of bounds panicking
pub fn slice_unchecked(&self, from: usize, to: usize) -> &'a [T]
[src]
Returns a subslice of this stream
pub fn slice_len(&self, from: usize, len: usize) -> &'a [T]
[src]
Same as slice, but the second argument is how many elements to slice
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for Stream<'a, T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T> Send for Stream<'a, T> where
T: Sync,
T: Sync,
impl<'a, T> Sync for Stream<'a, T> where
T: Sync,
T: Sync,
impl<'a, T> Unpin for Stream<'a, T>
impl<'a, T> UnwindSafe for Stream<'a, T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,