pub struct Map { /* private fields */ }
Expand description

Represents a created map.

Some methods require working with raw bytes. You may find libraries such as plain helpful.

Implementations

Returns a file descriptor to the underlying map.

Key size in bytes

Value size in bytes

Pin this map to bpffs.

Unpin from bpffs

Returns map value as Vec of u8.

key must have exactly Map::key_size() elements.

If the map is one of the per-cpu data structures, the function Map::lookup_percpu() must be used.

Returns one value per cpu as Vec of Vec of u8 for per per-cpu maps.

For normal maps, Map::lookup() must be used.

Deletes an element from the map.

key must have exactly Map::key_size() elements.

Same as Map::lookup() except this also deletes the key from the map.

Note that this operation is currently only implemented in the kernel for MapType::Queue and MapType::Stack.

key must have exactly Map::key_size() elements.

Update an element.

key must have exactly Map::key_size() elements. value must have exactly Map::value_size() elements.

For per-cpu maps, Map::update_percpu() must be used.

Update an element in an per-cpu map with one value per cpu.

key must have exactly Map::key_size() elements. value must have one element per cpu (see num_possible_cpus()) with exactly Map::value_size() elements each.

For per-cpu maps, Map::update_percpu() must be used.

Returns an iterator over keys in this map

Note that if the map is not stable (stable meaning no updates or deletes) during iteration, iteration can skip keys, restart from the beginning, or duplicate keys. In other words, iteration becomes unpredictable.

Create the bpf map standalone.

Attach a struct ops map

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.