pub struct RingBufferBuilder<'slf, 'cb> { /* private fields */ }
Expand description
Builds RingBuffer
instances.
ringbuf
s are a special kind of Map
, used to transfer data
between Program
s and userspace. As of Linux 5.8, the
ringbuf
map is now preferred over the perf buffer
.
Implementations§
Source§impl<'slf, 'cb: 'slf> RingBufferBuilder<'slf, 'cb>
impl<'slf, 'cb: 'slf> RingBufferBuilder<'slf, 'cb>
Sourcepub fn add<NewF>(
&mut self,
map: &'slf dyn MapCore,
callback: NewF,
) -> Result<&mut Self>
pub fn add<NewF>( &mut self, map: &'slf dyn MapCore, callback: NewF, ) -> Result<&mut Self>
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.
Negative return values in the callback will stop ring buffer consumption early and propagate the error code to the polling caller.
The callback provides a raw byte slice. You may find libraries such as
plain
helpful.
Sourcepub fn build(self) -> Result<RingBuffer<'cb>>
pub fn build(self) -> Result<RingBuffer<'cb>>
Build a new RingBuffer
. Must have added at least one ringbuf.
Trait Implementations§
Source§impl<'slf, 'cb> Debug for RingBufferBuilder<'slf, 'cb>
impl<'slf, 'cb> Debug for RingBufferBuilder<'slf, 'cb>
Source§impl<'slf, 'cb> Default for RingBufferBuilder<'slf, 'cb>
impl<'slf, 'cb> Default for RingBufferBuilder<'slf, 'cb>
Source§fn default() -> RingBufferBuilder<'slf, 'cb>
fn default() -> RingBufferBuilder<'slf, 'cb>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'slf, 'cb> Freeze for RingBufferBuilder<'slf, 'cb>
impl<'slf, 'cb> !RefUnwindSafe for RingBufferBuilder<'slf, 'cb>
impl<'slf, 'cb> !Send for RingBufferBuilder<'slf, 'cb>
impl<'slf, 'cb> !Sync for RingBufferBuilder<'slf, 'cb>
impl<'slf, 'cb> Unpin for RingBufferBuilder<'slf, 'cb>
impl<'slf, 'cb> !UnwindSafe for RingBufferBuilder<'slf, 'cb>
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