[−][src]Struct libbpf_rs::Map
Represents a created map.
Some methods require working with raw bytes. You may find libraries such as
plain helpful.
Implementations
impl Map[src]
pub fn name(&self) -> &str[src]
pub fn fd(&self) -> i32[src]
Returns a file descriptor to the underlying map.
pub fn map_type(&self) -> MapType[src]
pub fn key_size(&self) -> u32[src]
Key size in bytes
pub fn value_size(&self) -> u32[src]
Value size in bytes
pub fn pin<P: AsRef<Path>>(&mut self, path: P) -> Result<()>[src]
Pin this map to bpffs.
pub fn unpin<P: AsRef<Path>>(&mut self, path: P) -> Result<()>[src]
Unpin from bpffs
pub fn lookup(&self, key: &[u8], flags: MapFlags) -> Result<Option<Vec<u8>>>[src]
Returns map value as Vec of u8.
key must have exactly Map::key_size() elements.
pub fn delete(&mut self, key: &[u8]) -> Result<()>[src]
Deletes an element from the map.
key must have exactly Map::key_size() elements.
pub fn lookup_and_delete(&mut self, key: &[u8]) -> Result<Option<Vec<u8>>>[src]
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.
pub fn update(
&mut self,
key: &[u8],
value: &[u8],
flags: MapFlags
) -> Result<()>[src]
&mut self,
key: &[u8],
value: &[u8],
flags: MapFlags
) -> Result<()>
Update an element.
key must have exactly Map::key_size() elements. value must have exatly
Map::value_size() elements.
Auto Trait Implementations
impl RefUnwindSafe for Map[src]
impl !Send for Map[src]
impl !Sync for Map[src]
impl Unpin for Map[src]
impl UnwindSafe for Map[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,