Trait domain::base::wire::Parse

source ·
pub trait Parse<'a, Octs: ?Sized>: Sized {
    // Required method
    fn parse(parser: &mut Parser<'a, Octs>) -> Result<Self, ParseError>;
}
Expand description

An extension trait to add parsing to foreign types.

This trait can be used to add the parse method to a foreign type. For local types, the method should be added directly to the type instead.

Required Methods§

source

fn parse(parser: &mut Parser<'a, Octs>) -> Result<Self, ParseError>

Extracts a value from the beginning of parser.

If parsing fails and an error is returned, the parser’s position should be considered to be undefined. If it is supposed to be reused in this case, you should store the position before attempting to parse and seek to that position again before continuing.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a, Octs: AsRef<[u8]> + ?Sized> Parse<'a, Octs> for i8

source§

fn parse(parser: &mut Parser<'a, Octs>) -> Result<Self, ParseError>

source§

impl<'a, Octs: AsRef<[u8]> + ?Sized> Parse<'a, Octs> for i16

source§

fn parse(parser: &mut Parser<'a, Octs>) -> Result<Self, ParseError>

source§

impl<'a, Octs: AsRef<[u8]> + ?Sized> Parse<'a, Octs> for i32

source§

fn parse(parser: &mut Parser<'a, Octs>) -> Result<Self, ParseError>

source§

impl<'a, Octs: AsRef<[u8]> + ?Sized> Parse<'a, Octs> for i64

source§

fn parse(parser: &mut Parser<'a, Octs>) -> Result<Self, ParseError>

source§

impl<'a, Octs: AsRef<[u8]> + ?Sized> Parse<'a, Octs> for u8

source§

fn parse(parser: &mut Parser<'a, Octs>) -> Result<Self, ParseError>

source§

impl<'a, Octs: AsRef<[u8]> + ?Sized> Parse<'a, Octs> for u16

source§

fn parse(parser: &mut Parser<'a, Octs>) -> Result<Self, ParseError>

source§

impl<'a, Octs: AsRef<[u8]> + ?Sized> Parse<'a, Octs> for u32

source§

fn parse(parser: &mut Parser<'a, Octs>) -> Result<Self, ParseError>

source§

impl<'a, Octs: AsRef<[u8]> + ?Sized> Parse<'a, Octs> for u64

source§

fn parse(parser: &mut Parser<'a, Octs>) -> Result<Self, ParseError>

source§

impl<'a, Octs: AsRef<[u8]> + ?Sized, const N: usize> Parse<'a, Octs> for [u8; N]

source§

fn parse(parser: &mut Parser<'a, Octs>) -> Result<Self, ParseError>

Implementors§

source§

impl<'a, Octs: AsRef<[u8]> + ?Sized> Parse<'a, Octs> for Ipv4Addr

source§

impl<'a, Octs: AsRef<[u8]> + ?Sized> Parse<'a, Octs> for Ipv6Addr