Struct libbpf_rs::PerfBufferBuilder

source ·
pub struct PerfBufferBuilder<'a, 'b> { /* private fields */ }
Expand description

Builds PerfBuffer instances.

Implementations§

source§

impl<'a> PerfBufferBuilder<'a, '_>

source

pub fn new(map: &'a Map) -> Self

Create a new PerfBufferBuilder using the provided Map.

source§

impl<'a, 'b> PerfBufferBuilder<'a, 'b>

source

pub fn sample_cb<NewCb: SampleCb + 'b>( self, cb: NewCb, ) -> PerfBufferBuilder<'a, 'b>

Callback to run when a sample is received.

This callback provides a raw byte slice. You may find libraries such as plain helpful.

Callback arguments are: (cpu, data).

source

pub fn lost_cb<NewCb: LostCb + 'b>(self, cb: NewCb) -> PerfBufferBuilder<'a, 'b>

Callback to run when a sample is received.

Callback arguments are: (cpu, lost_count).

source

pub fn pages(self, pages: usize) -> PerfBufferBuilder<'a, 'b>

The number of pages to size the ring buffer.

source

pub fn build(self) -> Result<PerfBuffer<'b>>

Build the PerfBuffer object as configured.

Trait Implementations§

source§

impl Debug for PerfBufferBuilder<'_, '_>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, 'b> Freeze for PerfBufferBuilder<'a, 'b>

§

impl<'a, 'b> !RefUnwindSafe for PerfBufferBuilder<'a, 'b>

§

impl<'a, 'b> !Send for PerfBufferBuilder<'a, 'b>

§

impl<'a, 'b> !Sync for PerfBufferBuilder<'a, 'b>

§

impl<'a, 'b> Unpin for PerfBufferBuilder<'a, 'b>

§

impl<'a, 'b> !UnwindSafe for PerfBufferBuilder<'a, 'b>

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>,

§

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>,

§

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.