Struct libbpf_rs::OpenObject[][src]

pub struct OpenObject { /* fields omitted */ }
Expand description

Represents an opened (but not yet loaded) BPF object file.

Use this object to access OpenMaps and OpenPrograms.

Implementations

impl OpenObject[src]

pub unsafe fn from_ptr(ptr: *mut bpf_object) -> Result<Self>[src]

Takes ownership from pointer.

Safety

If ptr is unopen or already loaded then further operations on the returned object are undefined.

It is not safe to manipulate ptr after this operation.

pub fn take_ptr(self) -> *mut bpf_object[src]

Takes underlying libbpf_sys::bpf_object pointer.

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

pub fn map<T: AsRef<str>>(&self, name: T) -> Option<&OpenMap>[src]

Get a reference to OpenMap with the name name, if one exists.

pub fn map_mut<T: AsRef<str>>(&mut self, name: T) -> Option<&mut OpenMap>[src]

Get a mutable reference to OpenMap with the name name, if one exists.

pub fn maps_iter(&self) -> impl Iterator<Item = &OpenMap>[src]

Get an iterator over references to all OpenMaps. Note that this will include automatically generated .data, .rodata, .bss, and .kconfig maps.

pub fn maps_iter_mut(&mut self) -> impl Iterator<Item = &mut OpenMap>[src]

Get an iterator over mutable references to all OpenMaps. Note that this will include automatically generated .data, .rodata, .bss, and .kconfig maps.

pub fn prog<T: AsRef<str>>(&self, name: T) -> Option<&OpenProgram>[src]

Get a reference to OpenProgram with the name name, if one exists.

pub fn prog_mut<T: AsRef<str>>(&mut self, name: T) -> Option<&mut OpenProgram>[src]

Get a mutable reference to OpenProgram with the name name, if one exists.

pub fn progs_iter(&self) -> impl Iterator<Item = &OpenProgram>[src]

Get an iterator over references to all OpenPrograms.

pub fn progs_iter_mut(&mut self) -> impl Iterator<Item = &mut OpenProgram>[src]

Get an iterator over mutable references to all OpenPrograms.

pub fn load(self) -> Result<Object>[src]

Load the maps and programs contained in this BPF object into the system.

Trait Implementations

impl Drop for OpenObject[src]

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

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]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.