Skip to main content

MapInfo

Struct MapInfo 

Source
pub struct MapInfo(/* private fields */);
Expand description

Provides Provides metadata information about a loaded eBPF map.

Introduced in kernel v4.13.

Implementations§

Source§

impl MapInfo

Source

pub fn from_id(id: u32) -> Result<Self, MapError>

Loads map info from a map ID.

Uses kernel v4.13 features.

Source

pub fn map_type(&self) -> Result<MapType, MapError>

The type of map.

Introduced in kernel v4.13.

Source

pub const fn id(&self) -> u32

The unique ID for this map.

Introduced in kernel v4.13.

Source

pub const fn key_size(&self) -> u32

The key size for this map in bytes.

Introduced in kernel v4.13.

Source

pub const fn value_size(&self) -> u32

The value size for this map in bytes.

Introduced in kernel v4.13.

Source

pub const fn max_entries(&self) -> u32

The maximum number of entries in this map.

Introduced in kernel v4.13.

Source

pub const fn map_flags(&self) -> u32

The flags used in loading this map.

Introduced in kernel v4.13.

Source

pub fn name(&self) -> &[u8]

The name of the map, limited to 16 bytes.

Introduced in kernel v4.15.

Source

pub fn name_as_str(&self) -> Option<&str>

The name of the map as a &str.

None is returned if the name was not valid unicode or if field is not available.

Introduced in kernel v4.15.

Source

pub fn fd(&self) -> Result<MapFd, MapError>

Returns a file descriptor referencing the map.

The returned file descriptor can be closed at any time and doing so does not influence the life cycle of the map.

Uses kernel v4.13 features.

Source

pub fn from_pin<P: AsRef<Path>>(path: P) -> Result<Self, MapError>

Loads a map from a pinned path in bpffs.

Uses kernel v4.4 and v4.13 features.

Trait Implementations§

Source§

impl Debug for MapInfo

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>,

Source§

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>,

Source§

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.