[][src]Struct ethox::nic::external::External

pub struct External<T> { /* fields omitted */ }

An interface with buffers managed externally.

This implementation can be used in a number of ways. Firstly, it is good to mock a real interface in tests, allowing full control over the behaviour between operations. Secondly, it can be used as a temporary software buffer for virtualization purposes.

Methods

impl<T> External<T>[src]

pub fn set_one_past_receive(&mut self, at: usize)[src]

Set the index of the last to-receive buffer.

pub fn reset_send(&mut self)[src]

Reset sending, resending into the first buffer.

pub fn reset_receive(&mut self)[src]

Reset receiving, receiving the first buffer again.

impl<T, P> External<T> where
    T: Deref<Target = [P]>, 
[src]

pub fn new_send(buffer: T) -> Self[src]

A new external nic, only sending packets.

pub fn new_recv(buffer: T) -> Self[src]

A new external nic, only receiving packets.

pub fn to_recv(&self) -> usize[src]

Remaining number of buffers to receive.

pub fn to_send(&self) -> usize[src]

Remaining number of buffers to send.

pub fn receive_all(&mut self)[src]

Change the buffer state such that all packets are pending to be received.

pub fn send_all(&mut self)[src]

Change the buffer state such that all packets are pending to be sent.

pub fn get(&self, idx: usize) -> Option<&P>[src]

Get a reference to the buffer as the specified index.

pub fn get_mut(&mut self, idx: usize) -> Option<&mut P> where
    T: DerefMut
[src]

Get a mutable reference to the buffer as the specified index.

pub fn set_current_time(&mut self, instant: Instant)[src]

Update the timestamp on all future received packets.

Trait Implementations

impl<T, P> Device for External<T> where
    T: Deref<Target = [P]> + DerefMut,
    P: Payload
[src]

type Handle = Handle

The control handle type also providing packet meta information.

type Payload = P

The payload buffer type of this device. Read more

Auto Trait Implementations

impl<T> Send for External<T> where
    T: Send

impl<T> Sync for External<T> where
    T: Sync

impl<T> Unpin for External<T> where
    T: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.