Expand description
A hash map that can be shared between eBPF programs and user space.
Minimum kernel version
The minimum kernel version required to use this feature is 3.19.
Examples
use aya::maps::HashMap;
use std::convert::TryFrom;
let mut redirect_ports = HashMap::try_from(bpf.map_mut("REDIRECT_PORTS")?)?;
// redirect port 80 to 8080
redirect_ports.insert(80, 8080, 0);
// redirect port 443 to 8443
redirect_ports.insert(443, 8443, 0);
Implementations
sourceimpl<T: Deref<Target = Map>, K: Pod, V: Pod> HashMap<T, K, V>
impl<T: Deref<Target = Map>, K: Pod, V: Pod> HashMap<T, K, V>
sourcepub fn get(&self, key: &K, flags: u64) -> Result<V, MapError>
pub fn get(&self, key: &K, flags: u64) -> Result<V, MapError>
Returns a copy of the value associated with the key.
sourcepub fn iter(&self) -> MapIter<'_, K, V, Self>ⓘNotable traits for MapIter<'_, K, V, I>impl<K: Pod, V, I: IterableMap<K, V>> Iterator for MapIter<'_, K, V, I> type Item = Result<(K, V), MapError>;
pub fn iter(&self) -> MapIter<'_, K, V, Self>ⓘNotable traits for MapIter<'_, K, V, I>impl<K: Pod, V, I: IterableMap<K, V>> Iterator for MapIter<'_, K, V, I> type Item = Result<(K, V), MapError>;
An iterator visiting all key-value pairs in arbitrary order. The
iterator item type is Result<(K, V), MapError>
.
Trait Implementations
Auto Trait Implementations
impl<T, K, V> RefUnwindSafe for HashMap<T, K, V> where
K: RefUnwindSafe,
T: RefUnwindSafe,
V: RefUnwindSafe,
impl<T, K, V> Send for HashMap<T, K, V> where
K: Send,
T: Send,
V: Send,
impl<T, K, V> Sync for HashMap<T, K, V> where
K: Sync,
T: Sync,
V: Sync,
impl<T, K, V> Unpin for HashMap<T, K, V> where
K: Unpin,
T: Unpin,
V: Unpin,
impl<T, K, V> UnwindSafe for HashMap<T, K, V> where
K: UnwindSafe,
T: UnwindSafe,
V: UnwindSafe,
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