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: usizeLength of data in rx_buffer (0 if no pending packet)
Implementations§
Source§impl<'a, D: NetworkDriver> SmoltcpAdapter<'a, D>
impl<'a, D: NetworkDriver> SmoltcpAdapter<'a, D>
pub fn new(driver: &'a mut D) -> Self
Sourcepub fn poll_receive(&mut self)
pub fn poll_receive(&mut self)
Try to receive a packet into our internal buffer. Called before polling smoltcp.
Sourcepub fn collect_tx(&mut self)
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>
impl<'a, D: NetworkDriver> Device for SmoltcpAdapter<'a, D>
type RxToken<'b> = RxToken where Self: 'b
type TxToken<'b> = TxToken<'b, D> where Self: 'b
Source§fn receive(
&mut self,
_timestamp: Instant,
) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)>
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<'_>>
fn transmit(&mut self, _timestamp: Instant) -> Option<Self::TxToken<'_>>
Construct a transmit token. Read more
Source§fn capabilities(&self) -> DeviceCapabilities
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more