morpheus_network::mainloop::bare_metal

Struct SmoltcpAdapter

Source
pub struct SmoltcpAdapter<'a, D: NetworkDriver> {
    driver: &'a mut D,
    rx_buffer: [u8; 2048],
    rx_len: usize,
}
Expand description

Adapter bridging NetworkDriver to smoltcp Device trait.

This adapter uses a simple design where:

  • RX: Buffers received data internally, RxToken references it
  • TX: TxToken writes directly via the driver

Fields§

§driver: &'a mut D§rx_buffer: [u8; 2048]

Temporary buffer for received packet

§rx_len: usize

Length of data in rx_buffer (0 if no pending packet)

Implementations§

Source§

impl<'a, D: NetworkDriver> SmoltcpAdapter<'a, D>

Source

pub fn new(driver: &'a mut D) -> Self

Source

pub fn poll_receive(&mut self)

Try to receive a packet into our internal buffer. Called before polling smoltcp.

Source

pub fn refill_rx(&mut self)

Refill RX queue. Called in main loop Phase 1.

Source

pub fn collect_tx(&mut self)

Collect TX completions. Called in main loop Phase 5.

Trait Implementations§

Source§

impl<'a, D: NetworkDriver> Device for SmoltcpAdapter<'a, D>

Source§

type RxToken<'b> = RxToken where Self: 'b

Source§

type TxToken<'b> = TxToken<'b, D> where Self: 'b

Source§

fn receive( &mut self, _timestamp: Instant, ) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)>

Construct a token pair consisting of one receive token and one transmit token. Read more
Source§

fn transmit(&mut self, _timestamp: Instant) -> Option<Self::TxToken<'_>>

Construct a transmit token. Read more
Source§

fn capabilities(&self) -> DeviceCapabilities

Get a description of device capabilities.

Auto Trait Implementations§

§

impl<'a, D> Freeze for SmoltcpAdapter<'a, D>

§

impl<'a, D> RefUnwindSafe for SmoltcpAdapter<'a, D>
where D: RefUnwindSafe,

§

impl<'a, D> Send for SmoltcpAdapter<'a, D>
where D: Send,

§

impl<'a, D> Sync for SmoltcpAdapter<'a, D>
where D: Sync,

§

impl<'a, D> Unpin for SmoltcpAdapter<'a, D>

§

impl<'a, D> !UnwindSafe for SmoltcpAdapter<'a, D>

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.