Skip to content

Commit f37ced9

Browse files
Allow for setting a new event_id right before recording an event.
1 parent 47ca752 commit f37ced9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

measureme/src/profiler.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,15 @@ impl<'a, S: SerializationSink> Drop for TimingGuard<'a, S> {
155155
self.profiler.record_raw_event(&raw_event);
156156
}
157157
}
158+
159+
impl<'a, S: SerializationSink> TimingGuard<'a, S> {
160+
161+
/// This method set a new `event_id` right before actually recording the
162+
/// event.
163+
#[inline]
164+
pub fn finish_with_override_event_id(mut self, event_id: StringId) {
165+
self.event_id = event_id;
166+
// Let's be explicit about it: Dropping the guard will record the event.
167+
drop(self)
168+
}
169+
}

0 commit comments

Comments
 (0)