Struct Controller

Source
pub struct Controller<'a> { /* private fields */ }
Expand description

A reference to the endpoint of layers below (phy + eth).

This is not really useful on its own but should instead be used either within a Packet or a RawPacket. Some of the methods offered there will access the non-public members of this struct to fulfill their task.

Implementations§

Source§

impl<'a> Controller<'a>

Source

pub fn borrow_mut(&mut self) -> Controller<'_>

Proof to the compiler that we can shorten the lifetime arbitrarily.

Source

pub fn info(&self) -> &dyn Info

Get a reference to the network device information.

This is a central method since the ethernet layer abstracts over the phsical media in use. It splits the raw packet buffers supplied by the network device into a dynamic trait object with the device info (part of the handle) on one hand and the payload buffer on the other. This removes some detailed information on the device but simplifies layers on top.

Source

pub fn src_addr(&mut self) -> Address

Get the configured (source) address of the ethernet endpoint.

Source

pub fn send(&mut self) -> Result<()>

Try to send the packet associated with this controller.

Auto Trait Implementations§

§

impl<'a> Freeze for Controller<'a>

§

impl<'a> !RefUnwindSafe for Controller<'a>

§

impl<'a> !Send for Controller<'a>

§

impl<'a> !Sync for Controller<'a>

§

impl<'a> Unpin for Controller<'a>

§

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