Skip to main content

TraceProvider

Struct TraceProvider 

Source
pub struct TraceProvider { /* private fields */ }
Expand description

Use this object to start and run a trace provider under an existing libasync dispatcher handle.

You can use this in combination with libasync_scope_dispatcher to run the trace provider on top of fuchsia-async, for example:

#[fuchsia::main]
async fn main() {
    // create a new scoped async dispatcher object for the current fuchsia-async executor.
    let scope_dispatcher = libasync_scope_dispatcher::ScopeDispatcher::new();
    // create a trace provider on it.
    let trace_provider =
        fuchsia_trace_provider::TraceProvider::new_with_fdio(&scope_dispatcher, None);

    // run your program here...

    // drop the trace provider before shutting down the dispatcher since it will queue work
    // on the dispatcher.
    drop(trace_provider);
    // shutdown the dispatcher.
    scope_dispatcher.shutdown().await;
}

Note: As in the example above, make sure that this object is dropped before the dispatcher shuts down.

Implementations§

Source§

impl TraceProvider

Source

pub fn new_with_fdio( dispatcher: &impl AsAsyncDispatcherRef, name: Option<&CStr>, ) -> Option<Self>

Trait Implementations§

Source§

impl Drop for TraceProvider

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.