Struct smoltcp::iface::SliceArpCache
[−]
[src]
pub struct SliceArpCache<'a> { /* fields omitted */ }
An Address Resolution Protocol cache backed by a slice.
This cache uses a fixed-size storage, binary search, and a least recently used eviction strategy.
Examples
On systems with heap, this cache can be created with:
rust use smoltcp::iface::SliceArpCache; let mut arp_cache = SliceArpCache::new(vec![Default::default(); 8]);
On systems without heap, use:
rust use smoltcp::iface::SliceArpCache; let mut arp_cache_storage = [Default::default(); 8]; let mut arp_cache = SliceArpCache::new(&mut arp_cache_storage[..]);
Methods
impl<'a> SliceCache<'a>
[src]
fn new<T>(storage: T) -> SliceCache<'a> where
T: Into<ManagedSlice<'a, (IpAddress, EthernetAddress, usize)>>,
[src]
T: Into<ManagedSlice<'a, (IpAddress, EthernetAddress, usize)>>,
Create a cache. The backing storage is cleared upon creation.
Panics
This function panics if storage.len() == 0
.
Trait Implementations
impl<'a> Cache for SliceCache<'a>
[src]
fn fill(&mut self, protocol_addr: &IpAddress, hardware_addr: &EthernetAddress)
[src]
Update the cache to map given protocol address to given hardware address.
fn lookup(&mut self, protocol_addr: &IpAddress) -> Option<EthernetAddress>
[src]
Look up the hardware address corresponding for the given protocol address.