#[repr(C)]
pub struct EventDataDescriptor<'a> { /* private fields */ }
Expand description

Contains a reference to the data for an event field. The type of the data is not specified in this structure; instead, the type of the data is stored in the event’s metadata. (See win_etw_metadata::InFlag.)

The data that this type points to must have a well-defined (stable) byte representation. For example, u32 has a well-defined byte representation, as long as there is agreement about whether the value is stored in big-endian or little-endian order. Similarly, [u8] and [u32] have well-defined byte representations. However, types such as [bool] do not have a stable byte representation, and so EventDataDescriptor cannot point to &[bool].

This type provides implementations of From that can be used to point to event data. All of the EventDataDescriptor::From implementations for types require that the types have a stable, guaranteed byte representation, and that is legal (meaningful) to read that byte representation.

This type is equivalent to the Win32 structure EVENT_DATA_DESCRIPTOR, and its representation is guaranteed to be equivalent.

Implementation warning!

This code is responsible for ensuring memory safety. Even though it contains only simple primitives, these primitives are actually native pointers and pointer bounds. This data structure is passed to the ETW implementation, which dereferences those pointers. The Rust type checker cannot “see” these dereferences, since they occur in non-Rust code, so the borrow checker does not know that EventDataDescriptor deals with memory safety. This is why the phantom_ref field exists, and it is crucial that this code be used and encapsulated correctly.

For type safety to be conserved, the following invariants must be maintained:

  • The 'a lifetime parameter of EventDataDescriptor<'a> must be correctly associated with the lifetime of any reference that is used to construct an instance of EventDataDescriptor.

  • The fields of EventDataDescriptor must remain private. Arbitrary user code cannot be permitted to construct instances of EventDataDescriptor with arbitrary values for these fields.

  • EventDataDescriptor should only be used to pass to ETW functions.

Implementations§

source§

impl EventDataDescriptor<'static>

source

pub fn empty() -> Self

Returns an empty data descriptor.

source§

impl<'a> EventDataDescriptor<'a>

source

pub fn for_provider_metadata(s: &'a [u8]) -> Self

Creates an EventDataDescriptor for provider metadata.

source

pub fn for_event_metadata(s: &'a [u8]) -> Self

Creates an EventDataDescriptor for the metadata that describes a single event.

source

pub fn for_bytes(s: &'a [u8]) -> Self

Creates a `EventDataDescriptor for a slice of bytes.

Trait Implementations§

source§

impl<'a> Clone for EventDataDescriptor<'a>

source§

fn clone(&self) -> EventDataDescriptor<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> From<&'a [bool]> for EventDataDescriptor<'a>

source§

fn from(value: &'a [bool]) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a [f32]> for EventDataDescriptor<'a>

source§

fn from(value: &'a [f32]) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a [f64]> for EventDataDescriptor<'a>

source§

fn from(value: &'a [f64]) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a [i16]> for EventDataDescriptor<'a>

source§

fn from(value: &'a [i16]) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a [i32]> for EventDataDescriptor<'a>

source§

fn from(value: &'a [i32]) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a [i64]> for EventDataDescriptor<'a>

source§

fn from(value: &'a [i64]) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a [i8]> for EventDataDescriptor<'a>

source§

fn from(value: &'a [i8]) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a [isize]> for EventDataDescriptor<'a>

source§

fn from(value: &'a [isize]) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a [u16]> for EventDataDescriptor<'a>

source§

fn from(value: &'a [u16]) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a [u32]> for EventDataDescriptor<'a>

source§

fn from(value: &'a [u32]) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a [u64]> for EventDataDescriptor<'a>

source§

fn from(value: &'a [u64]) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a [u8]> for EventDataDescriptor<'a>

source§

fn from(value: &'a [u8]) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a [usize]> for EventDataDescriptor<'a>

source§

fn from(value: &'a [usize]) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a GUID> for EventDataDescriptor<'a>

source§

fn from(value: &'a GUID) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a SocketAddrV4> for EventDataDescriptor<'a>

source§

fn from(value: &'a SocketAddrV4) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a SocketAddrV6> for EventDataDescriptor<'a>

source§

fn from(value: &'a SocketAddrV6) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a U16CStr> for EventDataDescriptor<'a>

source§

fn from(value: &'a U16CStr) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a U16Str> for EventDataDescriptor<'a>

source§

fn from(value: &'a U16Str) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a bool> for EventDataDescriptor<'a>

source§

fn from(value: &'a bool) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a f32> for EventDataDescriptor<'a>

source§

fn from(value: &'a f32) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a f64> for EventDataDescriptor<'a>

source§

fn from(value: &'a f64) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a i16> for EventDataDescriptor<'a>

source§

fn from(value: &'a i16) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a i32> for EventDataDescriptor<'a>

source§

fn from(value: &'a i32) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a i64> for EventDataDescriptor<'a>

source§

fn from(value: &'a i64) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a i8> for EventDataDescriptor<'a>

source§

fn from(value: &'a i8) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a isize> for EventDataDescriptor<'a>

source§

fn from(value: &'a isize) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a str> for EventDataDescriptor<'a>

source§

fn from(value: &'a str) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a u16> for EventDataDescriptor<'a>

source§

fn from(value: &'a u16) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a u32> for EventDataDescriptor<'a>

source§

fn from(value: &'a u32) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a u64> for EventDataDescriptor<'a>

source§

fn from(value: &'a u64) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a u8> for EventDataDescriptor<'a>

source§

fn from(value: &'a u8) -> EventDataDescriptor<'a>

Converts to this type from the input type.
source§

impl<'a> From<&'a usize> for EventDataDescriptor<'a>

source§

fn from(value: &'a usize) -> EventDataDescriptor<'a>

Converts to this type from the input type.

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.