rustls_pki_types::server_name::parser

Struct Parser

source
pub(super) struct Parser<'a> {
    state: &'a [u8],
}

Fields§

§state: &'a [u8]

Implementations§

source§

impl<'a> Parser<'a>

source

pub(super) fn new(input: &'a [u8]) -> Self

source

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

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

source

pub(super) fn parse_with<T, F>( &mut self, inner: F, kind: AddrKind, ) -> Result<T, AddrParseError>
where F: FnOnce(&mut Parser<'_>) -> Option<T>,

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

source

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

Peek the next character from the input

source

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

Read the next character from the input

source

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

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>,

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>

source

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

Read an IPv4 address.

source

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> 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.