Struct Bytes

Source
pub struct Bytes<'a> {
    pub current_pos: usize,
    pub current_byte: Option<&'a u8>,
    pub buffer: Option<(usize, &'a [u8], Option<&'a u8>)>,
    pub input: &'a [u8],
}

Fields§

§current_pos: usize§current_byte: Option<&'a u8>§buffer: Option<(usize, &'a [u8], Option<&'a u8>)>§input: &'a [u8]

Implementations§

Source§

impl<'a> Bytes<'a>

Source

pub const fn new(input: &'a [u8]) -> Self

Source

pub fn advance(&mut self)

Source

pub unsafe fn advance_by(&mut self, num: usize)

Source

pub fn advance_to<F>(&mut self, delimiter: F) -> &'a [u8]
where F: Fn(u8) -> bool,

Source

pub fn buffered_advance_to<F>(&mut self, delimiter: F) -> &'a [u8]
where F: Fn(u8) -> bool,

Source

pub fn peek(&self, num: usize) -> Option<&[u8]>

Source

pub fn get_remainder(&self) -> &[u8]

Source

pub unsafe fn get_remainder_str_unchecked(&self) -> &str

Source

pub fn get_remainder_str(&self) -> Result<&str, ParseError>

Source

pub fn get_current_str(&self, start: usize) -> Result<&str, Utf8Error>

Source

pub fn finish(&mut self)

Source

pub fn reset(&mut self, position: usize)

Source

pub fn parse_digit(&mut self) -> Option<u8>

Source

pub fn parse_digits_strip_zeros(&mut self) -> BytesRange

Source

pub fn parse_digits(&mut self) -> BytesRange

Source

pub fn parse_8_digits(&mut self) -> Option<u64>

This method is based on the work of Daniel Lemire and his blog post https://lemire.me/blog/2018/09/30/quickly-identifying-a-sequence-of-digits-in-a-string-of-characters/

Source

pub fn next_is_ignore_ascii_case(&self, word: &[u8]) -> bool

Source

pub const fn is_end_of_input(&self) -> bool

Source

pub fn check_end_of_input(&self) -> Result<(), ParseError>

Source

pub fn try_consume_delimiter( &mut self, delimiter: Delimiter, ) -> Result<(), ParseError>

Auto Trait Implementations§

§

impl<'a> Freeze for Bytes<'a>

§

impl<'a> RefUnwindSafe for Bytes<'a>

§

impl<'a> Send for Bytes<'a>

§

impl<'a> Sync for Bytes<'a>

§

impl<'a> Unpin for Bytes<'a>

§

impl<'a> UnwindSafe for Bytes<'a>

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