[][src]Struct libbpf_rs::RingBufferBuilder

pub struct RingBufferBuilder { /* fields omitted */ }

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

impl RingBufferBuilder[src]

pub fn new() -> Self[src]

pub fn add<NewF>(&mut self, map: &Map, callback: NewF) -> Result<&mut Self> where
    NewF: FnMut(&[u8]) -> i32 + 'static, 
[src]

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.

pub fn build(self) -> Result<RingBuffer>[src]

Build a new RingBuffer. Must have added at least one ringbuf.

Trait Implementations

impl Default for RingBufferBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.