EventDataDescriptor

Struct EventDataDescriptor 

Source
pub struct EventDataDescriptor<'a> { /* private fields */ }
Expand description

Low-level API: Describes a block of data to be sent to user_events via TracepointState::write.

Note: This must have the same underlying representation as struct iovec.

Implementations§

Source§

impl<'a> EventDataDescriptor<'a>

Source

pub const fn zero() -> Self

Returns an EventDataDescriptor initialized with { null, 0 }.

Source

pub const fn is_empty(&self) -> bool

Returns true if this descriptor’s size is 0.

Source

pub const unsafe fn from_raw_ptr(ptr: usize, size: usize) -> Self

Returns an EventDataDescriptor initialized with the specified ptr and size.

§Safety

This bypasses lifetime tracking. Caller must ensure that this EventDataDescriptor is not used after the referenced data’s lifetime. Typically, this is done by overwriting the descriptor with EventDataDescriptor::zero after it has been used.

Source

pub fn from_bytes(value: &'a [u8]) -> Self

Returns an EventDataDescriptor initialized with the specified slice’s bytes.

Source

pub fn from_value<T: Copy>(value: &'a T) -> Self

Returns an EventDataDescriptor initialized with the specified value’s bytes.

Source

pub fn from_cstr<T: Copy + Default + Eq>(value: &'a [T]) -> Self

Returns an EventDataDescriptor for a nul-terminated string. Returned descriptor does NOT include the nul-termination.

Resulting descriptor’s size is the minimum of:

  • size_of::<T>() * 65535
  • size_of::<T>() * value.len()
  • size_of::<T>() * (index of first element equal to T::default())
Source

pub fn from_slice<T: Copy>(value: &'a [T]) -> Self

Returns an EventDataDescriptor for a variable-length array field.

Resulting descriptor’s size is the minimum of:

  • size_of::<T>() * 65535
  • size_of::<T>() * value.len()

Trait Implementations§

Source§

impl<'a> Debug for EventDataDescriptor<'a>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a> Default for EventDataDescriptor<'a>

Source§

fn default() -> EventDataDescriptor<'a>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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

Source§

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

Source§

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.