[−][src]Struct libbpf_rs::Object
Represents a loaded BPF object file.
An Object
is logically in charge of all the contained Program
s and Map
s 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
Auto Trait Implementations
impl RefUnwindSafe for Object
[src]
impl !Send for Object
[src]
impl !Sync for Object
[src]
impl Unpin for Object
[src]
impl UnwindSafe for Object
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,