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

Provides a convenience wrapper around a reference to a ProfileScope that ignores the lifetime mumbo.

If this object outlives its parent scope, there won’t be any errors; however, note that the profilings collected afterwards will not be printed.

Implementations§

source§

impl ProfileScopeHandleOwned

source

pub fn dummy() -> Self

Provides a dummy handle for if you are not interested in profiling, but need to use the functions.

source§

impl ProfileScopeHandleOwned

source

pub fn finish(self)

Finishes a scope, by janking the handle wrapping it out-of-scope.

Methods from Deref<Target = ProfileScope>§

source

pub fn time(&self, name: impl Into<String>) -> TimerGuard<'_>

Returns a TimerGuard, which takes a time exactly as long as it is in scope.

§Arguments
  • name: The name to set for this Timing.
§Returns

A new Timer struct to take a timing.

source

pub fn time_func<R>( &self, name: impl Into<String>, func: impl FnOnce() -> R, ) -> R

Profiles the given function and adds its timing under the given name.

§Arguments
  • name: The name to set for this Timing.
  • func: The function to profile.
§Returns

The result of the function, if any.

source

pub fn time_fut<'s, R>( &'s self, name: impl Into<String>, fut: impl 's + Future<Output = R>, ) -> impl 's + Future<Output = R>

Profiles the given future by creating a future that times it while running.

§Arguments
  • name: The name to set for this Timing.
  • fut: The Future to profile.
§Returns

A future that returns the same result as the given, but times its execution as a side-effect.

source

pub fn nest(&self, name: impl Into<String>) -> ProfileScopeHandle<'_>

Returns a new ProfileScope that can be used to do more elaborate nested timings.

§Arguments
  • name: The name of the new scope.
§Returns

A new ProfileScope that can be used to take timings.

source

pub fn nest_func<R>( &self, name: impl Into<String>, func: impl FnOnce(ProfileScopeHandle<'_>) -> R, ) -> R

Profiles the given function, but provides it with extra profile options by giving it its own ProfileScope to populate.

Note that the ProfileScope is already automatically given a “total”-timing, representing the function’s profiling. This is still untimed as long as the function sees it, obviously.

§Arguments
  • name: The name to set for this Timing.
  • func: The function to profile.
§Returns

The result of the function, if any.

source

pub fn nest_fut<'s, F: Future>( &'s self, name: impl Into<String>, fut: impl 's + FnOnce(ProfileScopeHandle<'s>) -> F, ) -> impl 's + Future<Output = F::Output>

Profiles the given future by creating a future that times it while running, but provides it with extra profile options by giving it its own ProfileScope to popupate.

Note that the ProfileScope is already automatically given a “total”-timing, representing the future’s profiling. This is still untimed as long as the future sees it, obviously.

§Arguments
  • name: The name to set for this Timing.
  • fut: The Future to profile.
§Returns

A future that returns the same result as the given, but times its execution as a side-effect.

source

pub fn display(&self) -> ProfileScopeFormatter<'_>

Returns a formatter that neatly displays the results of this scope.

Note that this does not end with a newline, so typically you want to call writeln!()/println!() on this.

§Returns

A new ProfileScopeFormatter.

source

pub fn display_indented(&self, indent: usize) -> ProfileScopeFormatter<'_>

Returns a formatter that neatly displays the results of this scope with a given number of spaces before each line.

Note that this does not end with a newline, so typically you want to call writeln!()/println!() on this.

§Arguments
  • indent: The number of spaces to print before each line.
§Returns

A new ProfileScopeFormatter.

Trait Implementations§

source§

impl Clone for ProfileScopeHandleOwned

source§

fn clone(&self) -> ProfileScopeHandleOwned

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 Debug for ProfileScopeHandleOwned

source§

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

Formats the value using the given formatter. Read more
source§

impl Deref for ProfileScopeHandleOwned

source§

type Target = ProfileScope

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'s> From<ProfileScopeHandle<'s>> for ProfileScopeHandleOwned

source§

fn from(value: ProfileScopeHandle<'s>) -> Self

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

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FromRef<T> for T
where T: Clone,

source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> ToOwned for T
where T: Clone,

source§

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

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

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

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T