Skip to main content

TrackDurationScope

Struct TrackDurationScope 

Source
pub struct TrackDurationScope<'a, C: CategoryString, S: AsTraceStrRef> { /* private fields */ }
Expand description

Scoped duration guard for a custom track. The duration ends and the trace record is written when the guard is dropped.

Under the hood, when the guard is dropped, it writes a single, complete DurationComplete event to the track backing virtual thread, which contains both the start time (stored in the guard) and the end time (determined at drop). This is highly efficient as it only writes a single record to the trace buffer.

Implementations§

Source§

impl<'a, C: CategoryString, S: AsTraceStrRef> TrackDurationScope<'a, C, S>

Source

pub fn begin( category: C, name: S, track: &'a Track, args: &'a [Arg<'_>], ) -> Self

Starts a new duration scope that starts now and will be end’ed when dropped.

Trait Implementations§

Source§

impl<'a, C: CategoryString, S: AsTraceStrRef> Drop for TrackDurationScope<'a, C, S>

Available on fuchsia_api_level_at_least=31 only.
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§

§

impl<'a, C, S> Freeze for TrackDurationScope<'a, C, S>
where C: Freeze, S: Freeze,

§

impl<'a, C, S> RefUnwindSafe for TrackDurationScope<'a, C, S>

§

impl<'a, C, S> Send for TrackDurationScope<'a, C, S>
where C: Send, S: Send,

§

impl<'a, C, S> Sync for TrackDurationScope<'a, C, S>
where C: Sync, S: Sync,

§

impl<'a, C, S> Unpin for TrackDurationScope<'a, C, S>
where C: Unpin, S: Unpin,

§

impl<'a, C, S> UnsafeUnpin for TrackDurationScope<'a, C, S>
where C: UnsafeUnpin, S: UnsafeUnpin,

§

impl<'a, C, S> UnwindSafe for TrackDurationScope<'a, C, S>
where C: UnwindSafe, S: UnwindSafe,

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 = 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>,

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.
§

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

§

fn vzip(self) -> V