Trait ParseReader

Source
pub trait ParseReader<'a>: Sized {
    // Required method
    fn parse(bytes: &'a [u8]) -> Result<Self, &'static str>;
}
Expand description

Trait to parse a protocol header.

Required Methods§

Source

fn parse(bytes: &'a [u8]) -> Result<Self, &'static str>

Parses the protocol header from the given slice.

Checks certain fields for validity.

May fail if any of the fields are deemed invalid.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a> ParseReader<'a> for ArpReader<'a>

Source§

impl<'a> ParseReader<'a> for EthernetReader<'a>

Source§

impl<'a> ParseReader<'a> for Icmpv4Reader<'a>

Source§

impl<'a> ParseReader<'a> for Icmpv6Reader<'a>

Source§

impl<'a> ParseReader<'a> for IPv4Reader<'a>

Source§

impl<'a> ParseReader<'a> for IPv6Reader<'a>

Source§

impl<'a> ParseReader<'a> for TcpReader<'a>

Source§

impl<'a> ParseReader<'a> for UdpReader<'a>