struct Parser<'a> {
state: &'a [u8],
}Fields§
§state: &'a [u8]Implementations§
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
fn new(input: &'a [u8]) -> Parser<'a>
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.
Sourcefn parse_with<T, F>(
&mut self,
inner: F,
kind: AddrKind,
) -> Result<T, AddrParseError>
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<()>
Reads 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)
Sourcefn read_radix_max_digits<T: ReadNumberHelper + TryFrom<u32>>(
&mut self,
radix: u32,
max_digits: u32,
allow_zero_prefix: bool,
) -> Option<T>
fn read_radix_max_digits<T: ReadNumberHelper + TryFrom<u32>>( &mut self, radix: u32, max_digits: u32, allow_zero_prefix: bool, ) -> Option<T>
Reads a number off the front of the input in the given radix, stopping at the first
non-digit character or eof. Fails if the number has more digits than max_digits, if there
is no number, if the number overflows T, or if there are leading zeros but
allow_zero_prefix is false.
max_digits must be in 1..=6.
Sourcefn read_decimal<T: ReadNumberHelper>(&mut self) -> Option<T>
fn read_decimal<T: ReadNumberHelper>(&mut self) -> Option<T>
Reads a decimal number off the front of the input, stopping at the first non-digit character
or eof. Fails if there is no number, or if the number overflows T. Allows an arbitrary
amount of leading zeros.
Sourcefn read_ipv4_addr(&mut self) -> Option<Ipv4Addr>
fn read_ipv4_addr(&mut self) -> Option<Ipv4Addr>
Reads an IPv4 address.
Sourcefn read_ipv6_addr(&mut self) -> Option<Ipv6Addr>
fn read_ipv6_addr(&mut self) -> Option<Ipv6Addr>
Reads an IPv6 address.
Sourcefn read_ip_addr(&mut self) -> Option<IpAddr>
fn read_ip_addr(&mut self) -> Option<IpAddr>
Reads an IP address, either IPv4 or IPv6.
Sourcefn read_scope_id(&mut self) -> Option<u32>
fn read_scope_id(&mut self) -> Option<u32>
Reads a % followed by a scope ID in base 10.
Sourcefn read_socket_addr_v4(&mut self) -> Option<SocketAddrV4>
fn read_socket_addr_v4(&mut self) -> Option<SocketAddrV4>
Reads an IPv4 address with a port.
Sourcefn read_socket_addr_v6(&mut self) -> Option<SocketAddrV6>
fn read_socket_addr_v6(&mut self) -> Option<SocketAddrV6>
Reads an IPv6 address with a port.
Sourcefn read_socket_addr(&mut self) -> Option<SocketAddr>
fn read_socket_addr(&mut self) -> Option<SocketAddr>
Reads an IP address with a port.
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> 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> SizeHint for Twhere
T: ?Sized,
impl<T> SizeHint for Twhere
T: ?Sized,
Source§default fn lower_bound(&self) -> usize
default fn lower_bound(&self) -> usize
core_io_internals)[u8; 12] could return any value between 0 and
12 inclusively as a correct implementation. Read moreSource§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)]const SIZE: usize = _
#[doc(hidden)]const SIZE: usize = _
sized_type_properties)Source§#[doc(hidden)]const ALIGN: usize = _
#[doc(hidden)]const ALIGN: usize = _
sized_type_properties)Source§#[doc(hidden)]const ALIGNMENT: Alignment = _
#[doc(hidden)]const ALIGNMENT: Alignment = _
ptr_alignment_type #102070)Source§#[doc(hidden)]const IS_ZST: bool = _
#[doc(hidden)]const IS_ZST: bool = _
sized_type_properties)Source§#[doc(hidden)]const LAYOUT: Layout = _
#[doc(hidden)]const LAYOUT: Layout = _
sized_type_properties)Source§#[doc(hidden)]const MAX_SLICE_LEN: usize = _
#[doc(hidden)]const MAX_SLICE_LEN: usize = _
sized_type_properties)[Self]. Read more