Expand description
A LIFO stack.
Minimum kernel version
The minimum kernel version required to use this feature is 4.20.
Examples
use aya::maps::Stack;
use std::convert::TryFrom;
let mut stack = Stack::try_from(bpf.map_mut("STACK")?)?;
stack.push(42, 0)?;
stack.push(43, 0)?;
assert_eq!(stack.pop(0)?, 43);
Implementations
sourceimpl<T: Deref<Target = Map> + DerefMut<Target = Map>, V: Pod> Stack<T, V>
impl<T: Deref<Target = Map> + DerefMut<Target = Map>, V: Pod> Stack<T, V>
sourcepub fn pop(&mut self, flags: u64) -> Result<V, MapError>
pub fn pop(&mut self, flags: u64) -> Result<V, MapError>
Removes the last element and returns it.
Errors
Returns MapError::ElementNotFound
if the stack is empty, MapError::SyscallError
if bpf_map_lookup_and_delete_elem
fails.
Trait Implementations
Auto Trait Implementations
impl<T, V> RefUnwindSafe for Stack<T, V> where
T: RefUnwindSafe,
V: RefUnwindSafe,
impl<T, V> Send for Stack<T, V> where
T: Send,
V: Send,
impl<T, V> Sync for Stack<T, V> where
T: Sync,
V: Sync,
impl<T, V> Unpin for Stack<T, V> where
T: Unpin,
V: Unpin,
impl<T, V> UnwindSafe for Stack<T, V> where
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