Struct smoltcp::iface::EthernetInterfaceBuilder
source · pub struct EthernetInterfaceBuilder<'b, 'c, 'e, DeviceT: for<'d> Device<'d>> { /* private fields */ }
Expand description
A builder structure used for creating a Ethernet network interface.
Implementations§
source§impl<'b, 'c, 'e, DeviceT> InterfaceBuilder<'b, 'c, 'e, DeviceT>where
DeviceT: for<'d> Device<'d>,
impl<'b, 'c, 'e, DeviceT> InterfaceBuilder<'b, 'c, 'e, DeviceT>where
DeviceT: for<'d> Device<'d>,
sourcepub fn new(device: DeviceT) -> Self
pub fn new(device: DeviceT) -> Self
Create a builder used for creating a network interface using the given device and address.
Examples
use smoltcp::iface::{EthernetInterfaceBuilder, NeighborCache};
use smoltcp::wire::{EthernetAddress, IpCidr, IpAddress};
let device = // ...
let hw_addr = // ...
let neighbor_cache = // ...
let ip_addrs = // ...
let iface = EthernetInterfaceBuilder::new(device)
.ethernet_addr(hw_addr)
.neighbor_cache(neighbor_cache)
.ip_addrs(ip_addrs)
.finalize();
sourcepub fn ethernet_addr(self, addr: EthernetAddress) -> Self
pub fn ethernet_addr(self, addr: EthernetAddress) -> Self
Set the Ethernet address the interface will use. See also ethernet_addr.
Panics
This function panics if the address is not unicast.
sourcepub fn ip_addrs<T>(self, ip_addrs: T) -> Selfwhere
T: Into<ManagedSlice<'c, IpCidr>>,
pub fn ip_addrs<T>(self, ip_addrs: T) -> Selfwhere
T: Into<ManagedSlice<'c, IpCidr>>,
sourcepub fn routes<T>(self, routes: T) -> InterfaceBuilder<'b, 'c, 'e, DeviceT>where
T: Into<Routes<'e>>,
pub fn routes<T>(self, routes: T) -> InterfaceBuilder<'b, 'c, 'e, DeviceT>where
T: Into<Routes<'e>>,
Set the IP routes the interface will use. See also routes.
sourcepub fn ipv4_multicast_groups<T>(self, ipv4_multicast_groups: T) -> Selfwhere
T: Into<ManagedMap<'e, Ipv4Address, ()>>,
pub fn ipv4_multicast_groups<T>(self, ipv4_multicast_groups: T) -> Selfwhere
T: Into<ManagedMap<'e, Ipv4Address, ()>>,
Provide storage for multicast groups.
Join multicast groups by calling join_multicast_group()
on an Interface
.
Using join_multicast_group()
will send initial membership reports.
A previously destroyed interface can be recreated by reusing the multicast group
storage, i.e. providing a non-empty storage to ipv4_multicast_groups()
.
Note that this way initial membership reports are not sent.
sourcepub fn neighbor_cache(self, neighbor_cache: NeighborCache<'b>) -> Self
pub fn neighbor_cache(self, neighbor_cache: NeighborCache<'b>) -> Self
Set the Neighbor Cache the interface will use.