embassy-net

Crates

0.1.0

Versions

default

Flavors

Struct Stack

Source
pub struct Stack<D: Driver> { /* private fields */ }
Expand description

A network stack.

This is the main entry point for the network stack.

Implementations§

Source§

impl<D: Driver + 'static> Stack<D>

Source

pub fn new<const SOCK: usize>( device: D, config: Config, resources: &'static mut StackResources<SOCK>, random_seed: u64, ) -> Self

Create a new network stack.

Source

pub fn ethernet_address(&self) -> [u8; 6]

Get the MAC address of the network interface.

Get whether the link is up.

Source

pub fn is_config_up(&self) -> bool

Get whether the network stack has a valid IP configuration. This is true if the network stack has a static IP configuration or if DHCP has completed

Source

pub fn config_v4(&self) -> Option<StaticConfigV4>

Get the current IPv4 configuration.

Source

pub fn config_v6(&self) -> Option<StaticConfigV6>

Get the current IPv6 configuration.

Source

pub async fn run(&self) -> !

Run the network stack.

You must call this in a background task, to process network events.

Source

pub async fn dns_query( &self, name: &str, qtype: DnsQueryType, ) -> Result<Vec<IpAddress, 1>, Error>

Make a query for a given name and return the corresponding IP addresses.

Source§

impl<D: Driver + Device + 'static> Stack<D>

Source

pub fn join_multicast_group<T>(&self, addr: T) -> Result<bool, MulticastError>
where T: Into<IpAddress>,

Join a multicast group.

Source

pub fn leave_multicast_group<T>(&self, addr: T) -> Result<bool, MulticastError>
where T: Into<IpAddress>,

Leave a multicast group.

Source

pub fn has_multicast_group<T: Into<IpAddress>>(&self, addr: T) -> bool

Get whether the network stack has joined the given multicast group.

Auto Trait Implementations§

§

impl<D> !Freeze for Stack<D>

§

impl<D> !RefUnwindSafe for Stack<D>

§

impl<D> Send for Stack<D>
where D: Send,

§

impl<D> !Sync for Stack<D>

§

impl<D> Unpin for Stack<D>
where D: Unpin,

§

impl<D> !UnwindSafe for Stack<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.