SmoltcpInterface

Struct SmoltcpInterface 

Source
pub struct SmoltcpInterface {
    device_adapter: NetDeviceAdapter,
    iface: Interface,
}
Expand description

Smoltcp 接口包装器,确保 Device 和 Interface 有相同的生命周期

Fields§

§device_adapter: NetDeviceAdapter§iface: Interface

Implementations§

Source§

impl SmoltcpInterface

Source

fn new(device: Arc<dyn NetDevice>, mac_address: EthernetAddress) -> Self

创建新的 smoltcp 接口包装器

Source

pub fn poll( &mut self, timestamp: Instant, sockets: &mut SocketSet<'_>, ) -> PollResult

轮询网络接口,处理接收和发送

§参数
  • timestamp - 当前时间戳
  • sockets - Socket 集合,用于处理网络协议栈的 socket 操作
§返回值

返回轮询结果,指示是否有事件被处理

Source

pub fn interface_mut(&mut self) -> &mut Interface

获取可变的 smoltcp Interface 引用

Source

pub fn interface(&self) -> &Interface

获取不可变的 smoltcp Interface 引用

Source

pub fn device_adapter_mut(&mut self) -> &mut NetDeviceAdapter

获取可变的 device adapter 引用

Source

pub fn into_interface(self) -> Interface

消费包装器,返回内部的Interface

Auto Trait Implementations§

§

impl Freeze for SmoltcpInterface

§

impl !RefUnwindSafe for SmoltcpInterface

§

impl Send for SmoltcpInterface

§

impl Sync for SmoltcpInterface

§

impl Unpin for SmoltcpInterface

§

impl !UnwindSafe for SmoltcpInterface

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.