esp_idf_svc::eth

Struct EspEth

Source
pub struct EspEth<'d, T> { /* private fields */ }
Expand description

EspEth wraps an EthDriver Data Link layer instance, and binds the OSI Layer 3 (network) facilities of ESP IDF to it.

In other words, it connects the ESP IDF ethernet Netif interface to the ethernet driver. This allows users to utilize the Rust STD APIs for working with TCP and UDP sockets.

This struct should be the default option for an ethernet driver in all use cases but the niche one where bypassing the ESP IDF Netif and lwIP stacks is desirable. E.g., using smoltcp or other custom IP stacks on top of the ESP IDF ethernet peripheral.

Implementations§

Source§

impl<'d, T> EspEth<'d, T>

Source

pub fn wrap(driver: EthDriver<'d, T>) -> Result<Self, EspError>

Source

pub fn wrap_all( driver: EthDriver<'d, T>, netif: EspNetif, ) -> Result<Self, EspError>

Source

pub fn swap_netif(&mut self, netif: EspNetif) -> Result<EspNetif, EspError>

Source

pub fn driver(&self) -> &EthDriver<'d, T>

Source

pub fn driver_mut(&mut self) -> &mut EthDriver<'d, T>

Source

pub fn netif(&self) -> &EspNetif

Source

pub fn netif_mut(&mut self) -> &mut EspNetif

Source

pub fn start(&mut self) -> Result<(), EspError>

Source

pub fn stop(&mut self) -> Result<(), EspError>

Source

pub fn is_started(&self) -> Result<bool, EspError>

Source

pub fn is_connected(&self) -> Result<bool, EspError>

Source

pub fn is_up(&self) -> Result<bool, EspError>

Trait Implementations§

Source§

impl<T> Drop for EspEth<'_, T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T> Eth for EspEth<'_, T>

Source§

type Error = EspError

Source§

fn start(&mut self) -> Result<(), Self::Error>

Source§

fn stop(&mut self) -> Result<(), Self::Error>

Source§

fn is_started(&self) -> Result<bool, Self::Error>

Source§

fn is_connected(&self) -> Result<bool, Self::Error>

Source§

impl<T> NetifStatus for EspEth<'_, T>

Source§

fn is_up(&self) -> Result<bool, EspError>

Source§

impl<T> NetifStatus for EspEth<'_, T>

Source§

async fn is_up(&self) -> Result<bool, EspError>

Source§

impl<T> RawHandle for EspEth<'_, T>

Source§

type Handle = *mut esp_eth_netif_glue_t

Source§

fn handle(&self) -> Self::Handle

Care should be taken to use the returned ESP-IDF driver raw handle only while the driver is still alive, so as to avoid use-after-free errors.
Source§

impl<T> Send for EspEth<'_, T>

Auto Trait Implementations§

§

impl<'d, T> Freeze for EspEth<'d, T>
where T: Freeze,

§

impl<'d, T> !RefUnwindSafe for EspEth<'d, T>

§

impl<'d, T> !Sync for EspEth<'d, T>

§

impl<'d, T> Unpin for EspEth<'d, T>
where T: Unpin,

§

impl<'d, T> !UnwindSafe for EspEth<'d, T>

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.