Struct relay_cogs::Token
source · pub struct Token { /* private fields */ }
Expand description
An in progress COGS measurement.
The measurement is recorded when the token is dropped.
Implementations§
source§impl Token
impl Token
sourcepub fn update<T: Into<FeatureWeights>>(&mut self, features: T)
pub fn update<T: Into<FeatureWeights>>(&mut self, features: T)
Updates the app features to which the active measurement is attributed to.
§Example:
fn process(cogs: &Cogs, item: &Item) {
let mut token = cogs.timed(ResourceId::Relay, AppFeature::Unattributed);
// App feature is only known after some computations.
if do_something(item) {
token.update(AppFeature::Spans);
} else {
token.update(AppFeature::Transactions);
}
}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Token
impl !RefUnwindSafe for Token
impl Send for Token
impl Sync for Token
impl Unpin for Token
impl !UnwindSafe for Token
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