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
sourceimpl<'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
.
pub fn new_with_limit<T>(storage: T, gc_threshold: usize) -> Cache<'a> where
T: Into<ManagedMap<'a, IpAddress, Neighbor>>,
pub fn fill(
&mut self,
protocol_addr: IpAddress,
hardware_addr: HardwareAddress,
timestamp: Instant
)
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Cache<'a>
impl<'a> Send for Cache<'a>
impl<'a> Sync for Cache<'a>
impl<'a> Unpin for Cache<'a>
impl<'a> !UnwindSafe for Cache<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more