Struct aya::maps::hash_map::HashMap[][src]

pub struct HashMap<T: Deref<Target = Map>, K, V> { /* fields omitted */ }
Expand description

A hash map that can be shared between eBPF programs and user space.

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

Returns a copy of the value associated with the key.

An iterator visiting all key-value pairs in arbitrary order. The iterator item type is Result<(K, V), MapError>.

An iterator visiting all keys in arbitrary order. The iterator element type is Result<K, MapError>.

Inserts a key-value pair into the map.

Removes a key from the map.

Trait Implementations

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.