[][src]Struct libbpf_rs::Object

pub struct Object { /* fields omitted */ }

Represents a loaded BPF object file.

An Object is logically in charge of all the contained Programs and Maps as well as the associated metadata and runtime state that underpins the userspace portions of BPF program execution. As a libbpf-rs user, you must keep the Object alive during the entire lifetime of your interaction with anything inside the Object.

Note that this is an explanation of the motivation -- Rust's lifetime system should already be enforcing this invariant.

Implementations

impl Object[src]

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

Takes ownership from pointer.

Safety

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

It is not safe to manipulate ptr after this operation.

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

pub fn map_unwrap<T: AsRef<str>>(&mut self, name: T) -> &mut Map[src]

Same as Object::map except will panic if Err or None is encountered.

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

pub fn prog_unwrap<T: AsRef<str>>(&mut self, name: T) -> &mut Program[src]

Same as Object::prog except will panic if Err or None is encountered.

Trait Implementations

impl Drop for Object[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

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.

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.