Struct EthPacket

Source
#[repr(C)]
pub struct EthPacket<'a> { pub buffer: Option<&'a IntermediateBuffer>, }
Expand description

This structure represents an Ethernet packet with an optional reference to an IntermediateBuffer.

A Rust equivalent for the _NDISRD_ETH_Packet structure.

The buffer field is an optional reference to an IntermediateBuffer. This design allows for flexibility when manipulating Ethernet packets, as a packet may not always have a buffer associated with it. This structure is particularly useful when the packet data needs to be read but not modified.

Fields§

§buffer: Option<&'a IntermediateBuffer>

An optional reference to an IntermediateBuffer representing the buffer for this Ethernet packet.

Trait Implementations§

Source§

impl<'a> AsRef<Option<&'a IntermediateBuffer>> for EthPacket<'a>

Implements the AsRef trait for EthPacket.

This implementation facilitates the conversion of an EthPacket into a reference to an Option<&'a IntermediateBuffer>. This conversion is useful when there is a need to directly access the buffer of a packet. By implementing AsRef for EthPacket, we provide a convenient and idiomatic way to perform this transformation.

Source§

fn as_ref(&self) -> &Option<&'a IntermediateBuffer>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'a> Default for EthPacket<'a>

Implements the Default trait for EthPacket.

This implementation allows for the creation of an “empty” EthPacket, i.e., a packet without a buffer. This is useful when initializing a variable of type EthPacket without immediately associating a buffer with it.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a> From<EthPacket<'a>> for Option<&'a IntermediateBuffer>

Implements the Into trait for EthPacket.

This implementation facilitates the conversion of an EthPacket into an Option<&'a IntermediateBuffer>. This conversion is useful when there is a need to directly manipulate the buffer of a packet. By implementing Into for EthPacket, we provide a convenient and idiomatic way to perform this transformation.

Source§

fn from(val: EthPacket<'a>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> Freeze for EthPacket<'a>

§

impl<'a> RefUnwindSafe for EthPacket<'a>

§

impl<'a> Send for EthPacket<'a>

§

impl<'a> Sync for EthPacket<'a>

§

impl<'a> Unpin for EthPacket<'a>

§

impl<'a> UnwindSafe for EthPacket<'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.