1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
//! This module contains traits defining common operations on BPF maps that can //! be executed both on the userspace side and the BPF side. use crate::error::Result; use crate::libbpf::BpfUpdateElemFlags; /// This trait is implemented by all the map wrapper types, as /// as convenient way to communicate their underlying types to the /// Rust type system. pub trait Map { type Key; type Value; } pub trait Update: Map { /// Update a value inside the map. /// /// This operation is considered as atomic. fn update<'a>( &'a mut self, key: &Self::Key, value: &Self::Value, flags: BpfUpdateElemFlags, ) -> Result<()>; }