pub struct ProfileScopeHandle<'s> { /* private fields */ }
Expand description
Provides a convenience wrapper around a reference to a ProfileScope.
Implementations§
Source§impl ProfileScopeHandle<'static>
impl ProfileScopeHandle<'static>
Source§impl<'s> ProfileScopeHandle<'s>
impl<'s> ProfileScopeHandle<'s>
Methods from Deref<Target = ProfileScope>§
Sourcepub fn time(&self, name: impl Into<String>) -> TimerGuard<'_>
pub fn time(&self, name: impl Into<String>) -> TimerGuard<'_>
Sourcepub fn time_fut<'s, R>(
&'s self,
name: impl Into<String>,
fut: impl 's + Future<Output = R>,
) -> impl 's + Future<Output = R>
pub fn time_fut<'s, R>( &'s self, name: impl Into<String>, fut: impl 's + Future<Output = R>, ) -> impl 's + Future<Output = R>
Sourcepub fn nest(&self, name: impl Into<String>) -> ProfileScopeHandle<'_>
pub fn nest(&self, name: impl Into<String>) -> ProfileScopeHandle<'_>
Sourcepub fn nest_func<R>(
&self,
name: impl Into<String>,
func: impl FnOnce(ProfileScopeHandle<'_>) -> R,
) -> R
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.
Sourcepub 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>
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.
Sourcepub fn display(&self) -> ProfileScopeFormatter<'_>
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.
Sourcepub fn display_indented(&self, indent: usize) -> ProfileScopeFormatter<'_>
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<'s> Clone for ProfileScopeHandle<'s>
impl<'s> Clone for ProfileScopeHandle<'s>
Source§fn clone(&self) -> ProfileScopeHandle<'s>
fn clone(&self) -> ProfileScopeHandle<'s>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<'s> Debug for ProfileScopeHandle<'s>
impl<'s> Debug for ProfileScopeHandle<'s>
Source§impl<'s> Deref for ProfileScopeHandle<'s>
impl<'s> Deref for ProfileScopeHandle<'s>
Source§impl<'s> From<ProfileScopeHandle<'s>> for ProfileScopeHandleOwned
impl<'s> From<ProfileScopeHandle<'s>> for ProfileScopeHandleOwned
Source§fn from(value: ProfileScopeHandle<'s>) -> Self
fn from(value: ProfileScopeHandle<'s>) -> Self
Auto Trait Implementations§
impl<'s> Freeze for ProfileScopeHandle<'s>
impl<'s> !RefUnwindSafe for ProfileScopeHandle<'s>
impl<'s> Send for ProfileScopeHandle<'s>
impl<'s> Sync for ProfileScopeHandle<'s>
impl<'s> Unpin for ProfileScopeHandle<'s>
impl<'s> !UnwindSafe for ProfileScopeHandle<'s>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request