pub struct ProfilingMiddleware {
pub profiler: Profiler,
pub active: bool,
}Expand description
A simple middleware layer that automatically profiles function calls.
Fields§
§profiler: ProfilerInner profiler instance.
active: boolWhether this middleware is active.
Implementations§
Source§impl ProfilingMiddleware
impl ProfilingMiddleware
Sourcepub fn instrument<F, T>(&mut self, name: &str, f: F) -> Twhere
F: FnOnce() -> T,
pub fn instrument<F, T>(&mut self, name: &str, f: F) -> Twhere
F: FnOnce() -> T,
Invoke a closure with profiling.
Sourcepub fn report(&self) -> ProfileReport
pub fn report(&self) -> ProfileReport
Get a report.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ProfilingMiddleware
impl RefUnwindSafe for ProfilingMiddleware
impl Send for ProfilingMiddleware
impl Sync for ProfilingMiddleware
impl Unpin for ProfilingMiddleware
impl UnsafeUnpin for ProfilingMiddleware
impl UnwindSafe for ProfilingMiddleware
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
Mutably borrows from an owned value. Read more