pub struct Queue<T: Deref<Target = Map>, V: Pod> { /* private fields */ }
Expand description

A FIFO queue.

Minimum kernel version

The minimum kernel version required to use this feature is 4.20.

Examples

use aya::maps::Queue;
use std::convert::TryFrom;

let mut queue = Queue::try_from(bpf.map_mut("ARRAY")?)?;
queue.push(42, 0)?;
queue.push(43, 0)?;
assert_eq!(queue.pop(0)?, 42);

Implementations

Returns the number of elements the queue can hold.

This corresponds to the value of bpf_map_def::max_entries on the eBPF side.

Removes the first element and returns it.

Errors

Returns MapError::ElementNotFound if the queue is empty, MapError::SyscallError if bpf_map_lookup_and_delete_elem fails.

Appends an element at the end of the queue.

Errors

MapError::SyscallError if bpf_map_update_elem fails.

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.

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.