pub(super) struct Parser<'a> {
state: &'a [u8],
}
Fields§
§state: &'a [u8]
Implementations§
source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
pub(super) fn new(input: &'a [u8]) -> Self
sourcefn read_atomically<T, F>(&mut self, inner: F) -> Option<T>
fn read_atomically<T, F>(&mut self, inner: F) -> Option<T>
Run a parser, and restore the pre-parse state if it fails.
sourcepub(super) fn parse_with<T, F>(
&mut self,
inner: F,
kind: AddrKind,
) -> Result<T, AddrParseError>
pub(super) fn parse_with<T, F>( &mut self, inner: F, kind: AddrKind, ) -> Result<T, AddrParseError>
Run a parser, but fail if the entire input wasn’t consumed. Doesn’t run atomically.
sourcefn read_given_char(&mut self, target: char) -> Option<()>
fn read_given_char(&mut self, target: char) -> Option<()>
Read the next character from the input if it matches the target.
sourcefn read_separator<T, F>(
&mut self,
sep: char,
index: usize,
inner: F,
) -> Option<T>
fn read_separator<T, F>( &mut self, sep: char, index: usize, inner: F, ) -> Option<T>
Helper for reading separators in an indexed loop. Reads the separator character iff index > 0, then runs the parser. When used in a loop, the separator character will only be read on index > 0 (see read_ipv4_addr for an example)
fn read_number<T: ReadNumberHelper>( &mut self, radix: u32, max_digits: Option<usize>, allow_zero_prefix: bool, ) -> Option<T>
sourcepub(super) fn read_ipv4_addr(&mut self) -> Option<Ipv4Addr>
pub(super) fn read_ipv4_addr(&mut self) -> Option<Ipv4Addr>
Read an IPv4 address.
sourcepub(super) fn read_ipv6_addr(&mut self) -> Option<Ipv6Addr>
pub(super) fn read_ipv6_addr(&mut self) -> Option<Ipv6Addr>
Read an IPv6 Address.
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> UnwindSafe for Parser<'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
Mutably borrows from an owned value. Read more