[][src]Struct win_etw_provider::EventDataDescriptor

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

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

impl EventDataDescriptor<'static>[src]

pub fn empty() -> Self[src]

Returns an empty data descriptor.

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

Creates an EventDataDescriptor for provider metadata. Provider metadata is required to have 'static lifetime.

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

Creates an EventDataDescriptor for the metadata that describes a single event. Event metadata is required to have 'static lifetime.

impl<'a> EventDataDescriptor<'a>[src]

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

Creates a `EventDataDescriptor for a slice of bytes.

Trait Implementations

impl<'a> Clone for EventDataDescriptor<'a>[src]

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

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

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

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

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

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

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

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

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

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

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

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

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

impl<'a> From<&'a GUID> for EventDataDescriptor<'a>[src]

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

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

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

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

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

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

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

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

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

impl<'a> From<&'a str> for EventDataDescriptor<'a>[src]

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

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

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

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

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

Auto Trait Implementations

impl<'a> RefUnwindSafe for EventDataDescriptor<'a>

impl<'a> Send for EventDataDescriptor<'a>

impl<'a> Sync for EventDataDescriptor<'a>

impl<'a> Unpin for EventDataDescriptor<'a>

impl<'a> UnwindSafe for EventDataDescriptor<'a>

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.