Struct libbpf_rs::OpenObject
source · [−]pub struct OpenObject { /* private fields */ }
Expand description
Represents an opened (but not yet loaded) BPF object file.
Use this object to access OpenMap
s and OpenProgram
s.
Implementations
sourceimpl OpenObject
impl OpenObject
sourcepub unsafe fn from_ptr(ptr: *mut bpf_object) -> Result<Self>
pub unsafe fn from_ptr(ptr: *mut bpf_object) -> Result<Self>
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.
sourcepub fn take_ptr(self) -> *mut bpf_object
pub fn take_ptr(self) -> *mut bpf_object
Takes underlying libbpf_sys::bpf_object
pointer.
pub fn name(&self) -> Result<&str>
sourcepub fn map<T: AsRef<str>>(&self, name: T) -> Option<&OpenMap>
pub fn map<T: AsRef<str>>(&self, name: T) -> Option<&OpenMap>
Get a reference to OpenMap
with the name name
, if one exists.
sourcepub fn map_mut<T: AsRef<str>>(&mut self, name: T) -> Option<&mut OpenMap>
pub fn map_mut<T: AsRef<str>>(&mut self, name: T) -> Option<&mut OpenMap>
Get a mutable reference to OpenMap
with the name name
, if one exists.
sourcepub fn maps_iter(&self) -> impl Iterator<Item = &OpenMap>
pub fn maps_iter(&self) -> impl Iterator<Item = &OpenMap>
Get an iterator over references to all OpenMap
s.
Note that this will include automatically generated .data, .rodata, .bss, and
.kconfig maps.
sourcepub fn maps_iter_mut(&mut self) -> impl Iterator<Item = &mut OpenMap>
pub fn maps_iter_mut(&mut self) -> impl Iterator<Item = &mut OpenMap>
Get an iterator over mutable references to all OpenMap
s.
Note that this will include automatically generated .data, .rodata, .bss, and
.kconfig maps.
sourcepub fn prog<T: AsRef<str>>(&self, name: T) -> Option<&OpenProgram>
pub fn prog<T: AsRef<str>>(&self, name: T) -> Option<&OpenProgram>
Get a reference to OpenProgram
with the name name
, if one exists.
sourcepub fn prog_mut<T: AsRef<str>>(&mut self, name: T) -> Option<&mut OpenProgram>
pub fn prog_mut<T: AsRef<str>>(&mut self, name: T) -> Option<&mut OpenProgram>
Get a mutable reference to OpenProgram
with the name name
, if one exists.
sourcepub fn progs_iter(&self) -> impl Iterator<Item = &OpenProgram>
pub fn progs_iter(&self) -> impl Iterator<Item = &OpenProgram>
Get an iterator over references to all OpenProgram
s.
sourcepub fn progs_iter_mut(&mut self) -> impl Iterator<Item = &mut OpenProgram>
pub fn progs_iter_mut(&mut self) -> impl Iterator<Item = &mut OpenProgram>
Get an iterator over mutable references to all OpenProgram
s.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for OpenObject
impl !Send for OpenObject
impl !Sync for OpenObject
impl Unpin for OpenObject
impl UnwindSafe for OpenObject
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more