libbpf_rs

Struct ObjectBuilder

Source
pub struct ObjectBuilder { /* private fields */ }
Expand description

Builder for creating an OpenObject. Typically the entry point into libbpf-rs.

Implementations§

Source§

impl ObjectBuilder

Source

pub fn name<T: AsRef<str>>(&mut self, name: T) -> Result<&mut Self>

Override the generated name that would have been inferred from the constructor.

Source

pub fn pin_root_path<T: AsRef<Path>>(&mut self, path: T) -> Result<&mut Self>

Set the pin_root_path for maps that are pinned by name.

By default, this is NULL which bpf translates to /sys/fs/bpf

Source

pub fn relaxed_maps(&mut self, relaxed_maps: bool) -> &mut Self

Option to parse map definitions non-strictly, allowing extra attributes/data

Source

pub fn debug(&mut self, dbg: bool) -> &mut Self

Option to print debug output to stderr.

Note: This function uses set_print internally and will overwrite any callbacks currently in use.

Source

pub fn open_file<P: AsRef<Path>>(&mut self, path: P) -> Result<OpenObject>

Open an object using the provided path on the file system.

Source

pub fn open_memory(&mut self, mem: &[u8]) -> Result<OpenObject>

Open an object from memory.

Trait Implementations§

Source§

impl AsRawLibbpf for ObjectBuilder

Source§

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

Retrieve the underlying libbpf_sys::bpf_object_open_opts.

Source§

type LibbpfType = bpf_object_open_opts

The underlying libbpf type.
Source§

impl Debug for ObjectBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ObjectBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.