Trait libbpf_rs::AsRawLibbpf

source ·
pub trait AsRawLibbpf {
    type LibbpfType;

    // Required method
    fn as_libbpf_object(&self) -> NonNull<Self::LibbpfType>;
}
Expand description

A trait implemented for types that are thin wrappers around libbpf types.

The trait provides access to the underlying libbpf (or libbpf-sys) object. In many cases, this enables direct usage of libbpf-sys functionality when higher-level bindings are not yet provided by this crate.

Required Associated Types§

source

type LibbpfType

The underlying libbpf type.

Required Methods§

source

fn as_libbpf_object(&self) -> NonNull<Self::LibbpfType>

Retrieve the underlying libbpf object.

§Warning

By virtue of working with a mutable raw pointer this method effectively circumvents mutability and liveness checks. While by-design, usage is meant as an escape-hatch more than anything else. If you find yourself making use of it, please consider discussing your workflow with crate maintainers to see if it would make sense to provide safer wrappers.

Implementors§