[][src]Struct smoltcp::iface::Routes

pub struct Routes<'a> { /* fields omitted */ }

A routing table.

Examples

On systems with heap, this table can be created with:

use std::collections::BTreeMap;
use smoltcp::iface::Routes;
let mut routes = Routes::new(BTreeMap::new());

On systems without heap, use:

use smoltcp::iface::Routes;
let mut routes_storage = [];
let mut routes = Routes::new(&mut routes_storage[..]);

Methods

impl<'a> Routes<'a>[src]

pub fn new<T>(storage: T) -> Routes<'a> where
    T: Into<ManagedMap<'a, IpCidr, Route>>, 
[src]

Creates a routing tables. The backing storage is not cleared upon creation.

pub fn update<F: FnOnce(&mut ManagedMap<'a, IpCidr, Route>)>(&mut self, f: F)[src]

Update the routes of this node.

pub fn add_default_ipv4_route(
    &mut self,
    gateway: Ipv4Address
) -> Result<Option<Route>>
[src]

Add a default ipv4 gateway (ie. "ip route add 0.0.0.0/0 via gateway").

On success, returns the previous default route, if any.

pub fn add_default_ipv6_route(
    &mut self,
    gateway: Ipv6Address
) -> Result<Option<Route>>
[src]

Add a default ipv6 gateway (ie. "ip -6 route add ::/0 via gateway").

On success, returns the previous default route, if any.

Trait Implementations

impl<'a> Debug for Routes<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Routes<'a>

impl<'a> Send for Routes<'a>

impl<'a> Sync for Routes<'a>

impl<'a> Unpin for Routes<'a>

impl<'a> !UnwindSafe for Routes<'a>

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.