pub struct Btf { /* private fields */ }
Expand description
Main representation of a parsed BTF object. Provides helpers to resolve types and their associated names.
Implementations§
Source§impl Btf
impl Btf
Sourcepub fn from_file<P: AsRef<Path>>(path: P) -> Result<Btf>
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Btf>
Parse a stand-alone BTF object file and construct a Rust representation for later
use. Trying to open split BTF files using this function will fail. For split BTF
files use Btf::from_split_file()
.
Sourcepub fn from_split_file<P: AsRef<Path>>(path: P, base: &Btf) -> Result<Btf>
pub fn from_split_file<P: AsRef<Path>>(path: P, base: &Btf) -> Result<Btf>
Parse a split BTF object file and construct a Rust representation for later use. A base Btf object must be provided.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Btf>
pub fn from_bytes(bytes: &[u8]) -> Result<Btf>
Performs the same actions as from_file(), but fed with a byte slice.
Sourcepub fn from_split_bytes(bytes: &[u8], base: &Btf) -> Result<Btf>
pub fn from_split_bytes(bytes: &[u8], base: &Btf) -> Result<Btf>
Performs the same actions as from_split_file(), but fed with a byte slice.
Sourcepub fn resolve_ids_by_name(&self, name: &str) -> Result<Vec<u32>>
pub fn resolve_ids_by_name(&self, name: &str) -> Result<Vec<u32>>
Find a list of BTF ids using their name as a key.
Sourcepub fn resolve_type_by_id(&self, id: u32) -> Result<Type>
pub fn resolve_type_by_id(&self, id: u32) -> Result<Type>
Find a BTF type using its id as a key.
Sourcepub fn resolve_types_by_name(&self, name: &str) -> Result<Vec<Type>>
pub fn resolve_types_by_name(&self, name: &str) -> Result<Vec<Type>>
Find a list of BTF types using their name as a key.
Sourcepub fn resolve_name<T: BtfType + ?Sized>(&self, type: &T) -> Result<String>
pub fn resolve_name<T: BtfType + ?Sized>(&self, type: &T) -> Result<String>
Resolve a name referenced by a Type which is defined in the current BTF object.