pub struct Btf<'source> { /* private fields */ }
Expand description
The btf information of a bpf object.
The lifetime bound protects against this object outliving its source. This can happen when it
was derived from an Object
, which owns the data this structs points too. When
instead the Btf::from_path
method is used, the lifetime will be 'static
since it doesn’t
borrow from anything.
Implementations§
source§impl Btf<'static>
impl Btf<'static>
sourcepub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self>
Load the btf information from specified path.
sourcepub fn from_vmlinux() -> Result<Self>
pub fn from_vmlinux() -> Result<Self>
Load the vmlinux btf information from few well-known locations.
sourcepub fn from_prog_id(id: u32) -> Result<Self>
pub fn from_prog_id(id: u32) -> Result<Self>
Load the btf information of an bpf object from a program id.
source§impl<'btf> Btf<'btf>
impl<'btf> Btf<'btf>
sourcepub fn from_bpf_object(obj: &'btf bpf_object) -> Result<Option<Self>>
pub fn from_bpf_object(obj: &'btf bpf_object) -> Result<Option<Self>>
Create a new Btf
instance from the given libbpf_sys::bpf_object
.
sourcepub fn from_raw(
name: &'btf str,
object_file: &'btf [u8],
) -> Result<Option<Self>>
pub fn from_raw( name: &'btf str, object_file: &'btf [u8], ) -> Result<Option<Self>>
From raw bytes coming from an object file.
sourcepub fn ptr_size(&self) -> Result<NonZeroUsize>
pub fn ptr_size(&self) -> Result<NonZeroUsize>
The btf pointer size.
sourcepub fn type_by_name<'s, K>(&'s self, name: &str) -> Option<K>
pub fn type_by_name<'s, K>(&'s self, name: &str) -> Option<K>
sourcepub fn type_by_id<'s, K>(&'s self, type_id: TypeId) -> Option<K>
pub fn type_by_id<'s, K>(&'s self, type_id: TypeId) -> Option<K>
Find a type by it’s TypeId.
sourcepub fn type_by_kind<'s, K>(&'s self) -> impl Iterator<Item = K> + 's
pub fn type_by_kind<'s, K>(&'s self) -> impl Iterator<Item = K> + 's
Find all types of a specific type kind.
Trait Implementations§
source§impl AsRawLibbpf for Btf<'_>
impl AsRawLibbpf for Btf<'_>
source§fn as_libbpf_object(&self) -> NonNull<Self::LibbpfType>
fn as_libbpf_object(&self) -> NonNull<Self::LibbpfType>
Retrieve the underlying libbpf_sys::btf
object.
§type LibbpfType = btf
type LibbpfType = btf
The underlying
libbpf
type.Auto Trait Implementations§
impl<'source> Freeze for Btf<'source>
impl<'source> RefUnwindSafe for Btf<'source>
impl<'source> !Send for Btf<'source>
impl<'source> !Sync for Btf<'source>
impl<'source> Unpin for Btf<'source>
impl<'source> UnwindSafe for Btf<'source>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more