Struct libbpf_rs::OpenMap

source ·
pub struct OpenMap { /* private fields */ }
Expand description

Represents a parsed but not yet loaded BPF map.

This object exposes operations that need to happen before the map is created.

Some methods require working with raw bytes. You may find libraries such as plain helpful.

Implementations§

source§

impl OpenMap

source

pub fn name(&self) -> Result<&str>

Retrieve the Map’s name.

source

pub fn map_type(&self) -> MapType

Retrieve type of the map.

source

pub fn initial_value(&self) -> Option<&[u8]>

Retrieve the initial value of the map.

source

pub fn initial_value_mut(&mut self) -> Option<&mut [u8]>

Retrieve the initial value of the map.

source

pub fn set_map_ifindex(&mut self, idx: u32)

source

pub fn set_initial_value(&mut self, data: &[u8]) -> Result<()>

source

pub fn set_type(&mut self, ty: MapType) -> Result<()>

source

pub fn set_key_size(&mut self, size: u32) -> Result<()>

source

pub fn set_value_size(&mut self, size: u32) -> Result<()>

source

pub fn set_max_entries(&mut self, count: u32) -> Result<()>

source

pub fn set_map_flags(&mut self, flags: u32) -> Result<()>

source

pub fn set_numa_node(&mut self, numa_node: u32) -> Result<()>

source

pub fn set_inner_map_fd(&mut self, inner: &Map)

source

pub fn set_map_extra(&mut self, map_extra: u64) -> Result<()>

source

pub fn set_autocreate(&mut self, autocreate: bool) -> Result<()>

source

pub fn set_pin_path<P: AsRef<Path>>(&mut self, path: P) -> Result<()>

source

pub fn reuse_fd(&self, fd: BorrowedFd<'_>) -> Result<()>

Reuse an fd for a BPF map

source

pub fn reuse_pinned_map<P: AsRef<Path>>(&mut self, path: P) -> Result<()>

Reuse an already-pinned map for self.

Trait Implementations§

source§

impl AsRawLibbpf for OpenMap

source§

fn as_libbpf_object(&self) -> NonNull<Self::LibbpfType>

Retrieve the underlying libbpf_sys::bpf_map.

§

type LibbpfType = bpf_map

The underlying libbpf type.
source§

impl Debug for OpenMap

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.