Skip to main content

Parser

Struct Parser 

Source
pub struct Parser<'a> {
    s: &'a [u8],
    pos: usize,
}

Fields§

§s: &'a [u8]§pos: usize

Implementations§

Source§

impl<'a> Parser<'a>

Source

fn new(s: &'a str) -> Parser<'a>

Source

fn is_eof(&self) -> bool

Source

fn read_atomically<T, F>(&mut self, cb: F) -> Option<T>
where F: FnOnce(&mut Parser<'_>) -> Option<T>,

Source

fn read_till_eof<T, F>(&mut self, cb: F) -> Option<T>
where F: FnOnce(&mut Parser<'_>) -> Option<T>,

Source

fn read_or<T>( &mut self, parsers: &mut [Box<dyn FnMut(&mut Parser<'_>) -> Option<T> + 'static>], ) -> Option<T>

Source

fn read_seq_3<A, B, C, PA, PB, PC>( &mut self, pa: PA, pb: PB, pc: PC, ) -> Option<(A, B, C)>
where PA: FnOnce(&mut Parser<'_>) -> Option<A>, PB: FnOnce(&mut Parser<'_>) -> Option<B>, PC: FnOnce(&mut Parser<'_>) -> Option<C>,

Source

fn read_char(&mut self) -> Option<char>

Source

fn read_given_char(&mut self, c: char) -> Option<char>

Source

fn read_digit(&mut self, radix: u8) -> Option<u8>

Source

fn read_number_impl( &mut self, radix: u8, max_digits: u32, upto: u32, ) -> Option<u32>

Source

fn read_number(&mut self, radix: u8, max_digits: u32, upto: u32) -> Option<u32>

Source

fn read_ipv4_addr_impl(&mut self) -> Option<Ipv4Addr>

Source

fn read_ipv4_addr(&mut self) -> Option<Ipv4Addr>

Source

fn read_ipv6_addr_impl(&mut self) -> Option<Ipv6Addr>

Source

fn read_ipv6_addr(&mut self) -> Option<Ipv6Addr>

Source

fn read_ipv4_net(&mut self) -> Option<Ipv4Net>

Source

fn read_ipv6_net(&mut self) -> Option<Ipv6Net>

Source

fn read_ip_net(&mut self) -> Option<IpNet>

Auto Trait Implementations§

§

impl<'a> Freeze for Parser<'a>

§

impl<'a> RefUnwindSafe for Parser<'a>

§

impl<'a> Send for Parser<'a>

§

impl<'a> Sync for Parser<'a>

§

impl<'a> Unpin for Parser<'a>

§

impl<'a> UnsafeUnpin for Parser<'a>

§

impl<'a> UnwindSafe for Parser<'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.