struct Parser<'a> {
state: &'a [u8],
}
ip_in_core
#108443)Fields§
§state: &'a [u8]
ip_in_core
#108443)Implementations§
source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
fn new(input: &'a [u8]) -> Parser<'a>
ip_in_core
#108443)sourcefn read_atomically<T, F>(&mut self, inner: F) -> Option<T>where
F: FnOnce(&mut Parser<'_>) -> Option<T>,
🔬This is a nightly-only experimental API. (ip_in_core
#108443)
fn read_atomically<T, F>(&mut self, inner: F) -> Option<T>where F: FnOnce(&mut Parser<'_>) -> Option<T>,
ip_in_core
#108443)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>where
F: FnOnce(&mut Parser<'_>) -> Option<T>,
🔬This is a nightly-only experimental API. (ip_in_core
#108443)
fn parse_with<T, F>( &mut self, inner: F, kind: AddrKind ) -> Result<T, AddrParseError>where F: FnOnce(&mut Parser<'_>) -> Option<T>,
ip_in_core
#108443)Run a parser, but fail if the entire input wasn’t consumed. Doesn’t run atomically.
sourcefn peek_char(&self) -> Option<char>
🔬This is a nightly-only experimental API. (ip_in_core
#108443)
fn peek_char(&self) -> Option<char>
ip_in_core
#108443)Peek the next character from the input
sourcefn read_char(&mut self) -> Option<char>
🔬This is a nightly-only experimental API. (ip_in_core
#108443)
fn read_char(&mut self) -> Option<char>
ip_in_core
#108443)Read the next character from the input
sourcefn read_given_char(&mut self, target: char) -> Option<()>
🔬This is a nightly-only experimental API. (ip_in_core
#108443)
fn read_given_char(&mut self, target: char) -> Option<()>
ip_in_core
#108443)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>where
F: FnOnce(&mut Parser<'_>) -> Option<T>,
🔬This is a nightly-only experimental API. (ip_in_core
#108443)
fn read_separator<T, F>( &mut self, sep: char, index: usize, inner: F ) -> Option<T>where F: FnOnce(&mut Parser<'_>) -> Option<T>,
ip_in_core
#108443)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>
ip_in_core
#108443)sourcefn read_ipv4_addr(&mut self) -> Option<Ipv4Addr>
🔬This is a nightly-only experimental API. (ip_in_core
#108443)
fn read_ipv4_addr(&mut self) -> Option<Ipv4Addr>
ip_in_core
#108443)Read an IPv4 address.
sourcefn read_ipv6_addr(&mut self) -> Option<Ipv6Addr>
🔬This is a nightly-only experimental API. (ip_in_core
#108443)
fn read_ipv6_addr(&mut self) -> Option<Ipv6Addr>
ip_in_core
#108443)Read an IPv6 Address.
sourcefn read_ip_addr(&mut self) -> Option<IpAddr>
🔬This is a nightly-only experimental API. (ip_in_core
#108443)
fn read_ip_addr(&mut self) -> Option<IpAddr>
ip_in_core
#108443)Read an IP Address, either IPv4 or IPv6.
sourcefn read_port(&mut self) -> Option<u16>
🔬This is a nightly-only experimental API. (ip_in_core
#108443)
fn read_port(&mut self) -> Option<u16>
ip_in_core
#108443)Read a :
followed by a port in base 10.
sourcefn read_scope_id(&mut self) -> Option<u32>
🔬This is a nightly-only experimental API. (ip_in_core
#108443)
fn read_scope_id(&mut self) -> Option<u32>
ip_in_core
#108443)Read a %
followed by a scope ID in base 10.
sourcefn read_socket_addr_v4(&mut self) -> Option<SocketAddrV4>
🔬This is a nightly-only experimental API. (ip_in_core
#108443)
fn read_socket_addr_v4(&mut self) -> Option<SocketAddrV4>
ip_in_core
#108443)Read an IPv4 address with a port.
sourcefn read_socket_addr_v6(&mut self) -> Option<SocketAddrV6>
🔬This is a nightly-only experimental API. (ip_in_core
#108443)
fn read_socket_addr_v6(&mut self) -> Option<SocketAddrV6>
ip_in_core
#108443)Read an IPv6 address with a port.
sourcefn read_socket_addr(&mut self) -> Option<SocketAddr>
🔬This is a nightly-only experimental API. (ip_in_core
#108443)
fn read_socket_addr(&mut self) -> Option<SocketAddr>
ip_in_core
#108443)Read an IP address with a port