Struct core::net::parser::Parser

source ·
struct Parser<'a> {
    state: &'a [u8],
}
🔬This is a nightly-only experimental API. (ip_in_core #108443)

Fields§

§state: &'a [u8]
🔬This is a nightly-only experimental API. (ip_in_core #108443)

Implementations§

source§

impl<'a> Parser<'a>

source

fn new(input: &'a [u8]) -> Parser<'a>

🔬This is a nightly-only experimental API. (ip_in_core #108443)
source

fn 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)

Run a parser, and restore the pre-parse state if it fails.

source

fn 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)

Run a parser, but fail if the entire input wasn’t consumed. Doesn’t run atomically.

source

fn peek_char(&self) -> Option<char>

🔬This is a nightly-only experimental API. (ip_in_core #108443)

Peek the next character from the input

source

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

🔬This is a nightly-only experimental API. (ip_in_core #108443)

Read the next character from the input

source

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

🔬This is a nightly-only experimental API. (ip_in_core #108443)

Read the next character from the input if it matches the target.

source

fn 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)

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)

source

fn read_number<T: ReadNumberHelper>( &mut self, radix: u32, max_digits: Option<usize>, allow_zero_prefix: bool ) -> Option<T>

🔬This is a nightly-only experimental API. (ip_in_core #108443)
source

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

🔬This is a nightly-only experimental API. (ip_in_core #108443)

Read an IPv4 address.

source

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

🔬This is a nightly-only experimental API. (ip_in_core #108443)

Read an IPv6 Address.

source

fn read_ip_addr(&mut self) -> Option<IpAddr>

🔬This is a nightly-only experimental API. (ip_in_core #108443)

Read an IP Address, either IPv4 or IPv6.

source

fn read_port(&mut self) -> Option<u16>

🔬This is a nightly-only experimental API. (ip_in_core #108443)

Read a : followed by a port in base 10.

source

fn read_scope_id(&mut self) -> Option<u32>

🔬This is a nightly-only experimental API. (ip_in_core #108443)

Read a % followed by a scope ID in base 10.

source

fn read_socket_addr_v4(&mut self) -> Option<SocketAddrV4>

🔬This is a nightly-only experimental API. (ip_in_core #108443)

Read an IPv4 address with a port.

source

fn read_socket_addr_v6(&mut self) -> Option<SocketAddrV6>

🔬This is a nightly-only experimental API. (ip_in_core #108443)

Read an IPv6 address with a port.

source

fn read_socket_addr(&mut self) -> Option<SocketAddr>

🔬This is a nightly-only experimental API. (ip_in_core #108443)

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

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> SizedTypeProperties for T

source§

const IS_ZST: bool = _

🔬This is a nightly-only experimental API. (sized_type_properties)
true if this type requires no storage. false if its size is greater than zero. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.