pub struct ObjectBuilder { /* private fields */ }
Expand description
Builder for creating an OpenObject
. Typically the entry point into libbpf-rs.
Implementations§
Source§impl ObjectBuilder
impl ObjectBuilder
Sourcepub fn name<T: AsRef<str>>(&mut self, name: T) -> Result<&mut Self>
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.
Sourcepub fn pin_root_path<T: AsRef<Path>>(&mut self, path: T) -> Result<&mut Self>
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
Sourcepub fn relaxed_maps(&mut self, relaxed_maps: bool) -> &mut Self
pub fn relaxed_maps(&mut self, relaxed_maps: bool) -> &mut Self
Option to parse map definitions non-strictly, allowing extra attributes/data
Sourcepub fn debug(&mut self, dbg: bool) -> &mut Self
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.
Sourcepub fn open_file<P: AsRef<Path>>(&mut self, path: P) -> Result<OpenObject>
pub fn open_file<P: AsRef<Path>>(&mut self, path: P) -> Result<OpenObject>
Open an object using the provided path on the file system.
Sourcepub fn open_memory(&mut self, mem: &[u8]) -> Result<OpenObject>
pub fn open_memory(&mut self, mem: &[u8]) -> Result<OpenObject>
Open an object from memory.
Trait Implementations§
Source§impl AsRawLibbpf for ObjectBuilder
impl AsRawLibbpf for ObjectBuilder
Source§fn as_libbpf_object(&self) -> NonNull<Self::LibbpfType>
fn as_libbpf_object(&self) -> NonNull<Self::LibbpfType>
Retrieve the underlying libbpf_sys::bpf_object_open_opts
.
Source§type LibbpfType = bpf_object_open_opts
type LibbpfType = bpf_object_open_opts
The underlying
libbpf
type.Source§impl Debug for ObjectBuilder
impl Debug for ObjectBuilder
Auto Trait Implementations§
impl Freeze for ObjectBuilder
impl RefUnwindSafe for ObjectBuilder
impl !Send for ObjectBuilder
impl !Sync for ObjectBuilder
impl Unpin for ObjectBuilder
impl UnwindSafe for ObjectBuilder
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