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>
impl<'a> EventDataDescriptor<'a>
Sourcepub const unsafe fn from_raw_ptr(ptr: usize, size: usize) -> Self
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.
Sourcepub fn from_bytes(value: &'a [u8]) -> Self
pub fn from_bytes(value: &'a [u8]) -> Self
Returns an EventDataDescriptor initialized with the specified slice’s bytes.
Sourcepub fn from_value<T: Copy>(value: &'a T) -> Self
pub fn from_value<T: Copy>(value: &'a T) -> Self
Returns an EventDataDescriptor initialized with the specified value’s bytes.
Sourcepub fn from_cstr<T: Copy + Default + Eq>(value: &'a [T]) -> Self
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>() * 65535size_of::<T>() * value.len()size_of::<T>() * (index of first element equal to T::default())
Sourcepub fn from_slice<T: Copy>(value: &'a [T]) -> Self
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>() * 65535size_of::<T>() * value.len()