Struct libbpf_rs::RingBufferBuilder
source · [−]pub struct RingBufferBuilder { /* private fields */ }Expand description
Builds RingBuffer instances.
ringbufs are a special kind of Map, used to transfer data between
Programs and userspace. As of Linux 5.8, the ringbuf map is now
preferred over the perf buffer.
Implementations
sourceimpl RingBufferBuilder
impl RingBufferBuilder
pub fn new() -> Self
sourcepub fn add<NewF>(&mut self, map: &Map, callback: NewF) -> Result<&mut Self> where
NewF: FnMut(&[u8]) -> i32 + 'static,
pub fn add<NewF>(&mut self, map: &Map, callback: NewF) -> Result<&mut Self> where
NewF: FnMut(&[u8]) -> i32 + 'static,
Add a new ringbuf map and associated callback to this ring buffer
manager. The callback should take one argument, a slice of raw bytes,
and return an i32.
Non-zero return values in the callback will stop ring buffer consumption early.
The callback provides a raw byte slice. You may find libraries such as
plain helpful.
sourcepub fn build(self) -> Result<RingBuffer>
pub fn build(self) -> Result<RingBuffer>
Build a new RingBuffer. Must have added at least one ringbuf.
Trait Implementations
sourceimpl Default for RingBufferBuilder
impl Default for RingBufferBuilder
sourcefn default() -> RingBufferBuilder
fn default() -> RingBufferBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl !RefUnwindSafe for RingBufferBuilder
impl !Send for RingBufferBuilder
impl !Sync for RingBufferBuilder
impl Unpin for RingBufferBuilder
impl !UnwindSafe for RingBufferBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more