pub struct MapImpl<'obj, T = ()> { /* private fields */ }Expand description
Represents a libbpf-created map.
Some methods require working with raw bytes. You may find libraries such as
plain helpful.
Implementations§
Source§impl<'obj> MapImpl<'obj>
impl<'obj> MapImpl<'obj>
Sourcepub fn new(map: &'obj bpf_map) -> Self
pub fn new(map: &'obj bpf_map) -> Self
Create a Map from a libbpf_sys::bpf_map.
Sourcepub fn get_pin_path(&self) -> Option<&OsStr>
pub fn get_pin_path(&self) -> Option<&OsStr>
Returns the pin_path if the map is pinned, otherwise, None
is returned.
Sourcepub fn autocreate(&self) -> bool
pub fn autocreate(&self) -> bool
Return true if the map was set to be auto-created during load, false otherwise.
Trait Implementations§
Source§impl<T> AsFd for MapImpl<'_, T>
impl<T> AsFd for MapImpl<'_, T>
Source§fn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
Borrows the file descriptor. Read more
Source§impl<T> MapCore for MapImpl<'_, T>where
T: Debug,
impl<T> MapCore for MapImpl<'_, T>where
T: Debug,
Source§fn value_size(&self) -> u32
fn value_size(&self) -> u32
Retrieve the size of the map’s values.
Source§fn max_entries(&self) -> u32
fn max_entries(&self) -> u32
Retrieve
max_entries of the map.Source§fn lookup_into(
&self,
key: &[u8],
value: &mut [u8],
flags: MapFlags,
) -> Result<bool>
fn lookup_into( &self, key: &[u8], value: &mut [u8], flags: MapFlags, ) -> Result<bool>
Looks up a map value into a pre-allocated buffer, avoiding allocation. Read more
Source§fn lookup_batch(
&self,
count: u32,
elem_flags: MapFlags,
flags: MapFlags,
) -> Result<BatchedMapIter<'_>>
fn lookup_batch( &self, count: u32, elem_flags: MapFlags, flags: MapFlags, ) -> Result<BatchedMapIter<'_>>
Returns many elements in batch mode from the map. Read more
Source§fn lookup_and_delete_batch(
&self,
count: u32,
elem_flags: MapFlags,
flags: MapFlags,
) -> Result<BatchedMapIter<'_>>
fn lookup_and_delete_batch( &self, count: u32, elem_flags: MapFlags, flags: MapFlags, ) -> Result<BatchedMapIter<'_>>
Returns many elements in batch mode from the map. Read more
Source§fn delete_batch(
&self,
keys: &[u8],
count: u32,
elem_flags: MapFlags,
flags: MapFlags,
) -> Result<()>
fn delete_batch( &self, keys: &[u8], count: u32, elem_flags: MapFlags, flags: MapFlags, ) -> Result<()>
Deletes many elements in batch mode from the map. Read more
Source§fn lookup_and_delete(&self, key: &[u8]) -> Result<Option<Vec<u8>>>
fn lookup_and_delete(&self, key: &[u8]) -> Result<Option<Vec<u8>>>
Same as
Self::lookup() except this also deletes the key from the map. Read moreSource§fn update(&self, key: &[u8], value: &[u8], flags: MapFlags) -> Result<()>
fn update(&self, key: &[u8], value: &[u8], flags: MapFlags) -> Result<()>
Update an element. Read more
Auto Trait Implementations§
impl<'obj, T> Freeze for MapImpl<'obj, T>
impl<'obj, T> RefUnwindSafe for MapImpl<'obj, T>where
T: RefUnwindSafe,
impl<'obj, T = ()> !Send for MapImpl<'obj, T>
impl<'obj, T = ()> !Sync for MapImpl<'obj, T>
impl<'obj, T> Unpin for MapImpl<'obj, T>
impl<'obj, T> UnwindSafe for MapImpl<'obj, T>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more