Struct smoltcp::iface::NeighborCache
source · pub struct NeighborCache<'a> { /* private fields */ }
Expand description
A neighbor cache backed by a map.
Examples
On systems with heap, this cache can be created with:
use std::collections::BTreeMap;
use smoltcp::iface::NeighborCache;
let mut neighbor_cache = NeighborCache::new(BTreeMap::new());
On systems without heap, use:
use smoltcp::iface::NeighborCache;
let mut neighbor_cache_storage = [None; 8];
let mut neighbor_cache = NeighborCache::new(&mut neighbor_cache_storage[..]);
Implementations§
source§impl<'a> Cache<'a>
impl<'a> Cache<'a>
sourcepub fn new<T>(storage: T) -> Cache<'a>where
T: Into<ManagedMap<'a, IpAddress, Neighbor>>,
pub fn new<T>(storage: T) -> Cache<'a>where
T: Into<ManagedMap<'a, IpAddress, Neighbor>>,
Create a cache. The backing storage is cleared upon creation.
Panics
This function panics if storage.len() == 0
.