pub struct ProviderBuilder { /* private fields */ }
Expand description

A Builder for a Provider

See Provider for various functions that create ProviderBuilders.

Implementations§

source§

impl ProviderBuilder

source

pub fn any(self, any: u64) -> Self

Set the any flag in the Provider instance More info

Example
let my_provider = Provider::by_guid("1EDEEE53-0AFE-4609-B846-D8C0B2075B1F").any(0xf0010000000003ff).build();
source

pub fn all(self, all: u64) -> Self

Set the all flag in the Provider instance More info

Example
let my_provider = Provider::by_guid("1EDEEE53-0AFE-4609-B846-D8C0B2075B1F").all(0x4000000000000000).build();
source

pub fn level(self, level: u8) -> Self

Set the level flag in the Provider instance

Example
// LogAlways (0x0)
// Critical (0x1)
// Error (0x2)
// Warning (0x3)
// Information (0x4)
// Verbose (0x5)
let my_provider = Provider::by_guid("1EDEEE53-0AFE-4609-B846-D8C0B2075B1F").level(0x5).build();
source

pub fn trace_flags(self, trace_flags: TraceFlags) -> Self

Set the trace_flags flag in the Provider instance More info

Example
let my_provider = Provider::by_guid("1EDEEE53-0AFE-4609-B846-D8C0B2075B1F").trace_flags(TraceFlags::EVENT_ENABLE_PROPERTY_SID).build();
source

pub fn add_callback<T>(self, callback: T) -> Selfwhere T: FnMut(&EventRecord, &SchemaLocator) + Send + Sync + 'static,

Add a callback function that will be called when the Provider generates an Event

Notes

The callback will be run on a background thread (the one that is blocked on the process function).

Example
let provider = Provider::by_guid("1EDEEE53-0AFE-4609-B846-D8C0B2075B1F").add_callback(|record: &EventRecord, schema_locator: &SchemaLocator| {
    // Handle Event
}).build();
UserTrace::new().enable(provider).start().unwrap();
source

pub fn add_filter(self, filter: EventFilter) -> Self

Add a filter to this Provider.

Adding multiple filters will bind them with an AND relationship.
If you want an OR relationship, include them in the same EventFilter.

Example
let only_events_18_or_42 = EventFilter::ByEventIds(vec![18, 42]);
let only_pid_1234 = EventFilter::ByPids(vec![1234]);

Provider::by_guid("22fb2cd6-0e7b-422b-a0c7-2fad1fd0e716")
    .add_filter(only_events_18_or_42)
    .add_filter(only_pid_1234)
    .build();
source

pub fn build(self) -> Provider

Build the provider

Example
Provider::by_guid("22fb2cd6-0e7b-422b-a0c7-2fad1fd0e716") // Microsoft-Windows-Kernel-Process
  .add_callback(process_callback)
  .build();

Trait Implementations§

source§

impl Debug for ProviderBuilder

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V