[][src]Struct smoltcp::iface::EthernetInterfaceBuilder

pub struct EthernetInterfaceBuilder<'b, 'c, 'e, DeviceT: for<'d> Device<'d>> { /* fields omitted */ }

A builder structure used for creating a Ethernet network interface.

Methods

impl<'b, 'c, 'e, DeviceT> InterfaceBuilder<'b, 'c, 'e, DeviceT> where
    DeviceT: for<'d> Device<'d>, 
[src]

pub fn new(device: DeviceT) -> Self[src]

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();

pub fn ethernet_addr(self, addr: EthernetAddress) -> Self[src]

Set the Ethernet address the interface will use. See also ethernet_addr.

Panics

This function panics if the address is not unicast.

pub fn ip_addrs<T>(self, ip_addrs: T) -> Self where
    T: Into<ManagedSlice<'c, IpCidr>>, 
[src]

Set the IP addresses the interface will use. See also ip_addrs.

Panics

This function panics if any of the addresses are not unicast.

pub fn any_ip(self, enabled: bool) -> Self[src]

Enable or disable the AnyIP capability, allowing packets to be received locally on IPv4 addresses other than the interface's configured ip_addrs. When AnyIP is enabled and a route prefix in routes specifies one of the interface's ip_addrs as its gateway, the interface will accept packets addressed to that prefix.

IPv6

This option is not available or required for IPv6 as packets sent to the interface are not filtered by IPv6 address.

pub fn routes<T>(self, routes: T) -> InterfaceBuilder<'b, 'c, 'e, DeviceT> where
    T: Into<Routes<'e>>, 
[src]

Set the IP routes the interface will use. See also routes.

pub fn ipv4_multicast_groups<T>(self, ipv4_multicast_groups: T) -> Self where
    T: Into<ManagedMap<'e, Ipv4Address, ()>>, 
[src]

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.

pub fn neighbor_cache(self, neighbor_cache: NeighborCache<'b>) -> Self[src]

Set the Neighbor Cache the interface will use.

pub fn finalize(self) -> Interface<'b, 'c, 'e, DeviceT>[src]

Create a network interface using the previously provided configuration.

Panics

If a required option is not provided, this function will panic. Required options are:

Auto Trait Implementations

impl<'b, 'c, 'e, DeviceT> RefUnwindSafe for InterfaceBuilder<'b, 'c, 'e, DeviceT> where
    DeviceT: RefUnwindSafe

impl<'b, 'c, 'e, DeviceT> Send for InterfaceBuilder<'b, 'c, 'e, DeviceT> where
    DeviceT: Send

impl<'b, 'c, 'e, DeviceT> Sync for InterfaceBuilder<'b, 'c, 'e, DeviceT> where
    DeviceT: Sync

impl<'b, 'c, 'e, DeviceT> Unpin for InterfaceBuilder<'b, 'c, 'e, DeviceT> where
    DeviceT: Unpin

impl<'b, 'c, 'e, DeviceT> !UnwindSafe for InterfaceBuilder<'b, 'c, 'e, DeviceT>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.