Bring back verbose_generic_activity_with_arg

This commit is contained in:
John Kåre Alsaker 2023-09-13 13:12:51 +02:00
parent 9624c30965
commit c64e15e817

View File

@ -223,6 +223,25 @@ impl SelfProfilerRef {
VerboseTimingGuard::start(message_and_format, self.generic_activity(event_label))
}
/// Like `verbose_generic_activity`, but with an extra arg.
pub fn verbose_generic_activity_with_arg<A>(
&self,
event_label: &'static str,
event_arg: A,
) -> VerboseTimingGuard<'_>
where
A: Borrow<str> + Into<String>,
{
let message_and_format = self
.print_verbose_generic_activities
.map(|format| (format!("{}({})", event_label, event_arg.borrow()), format));
VerboseTimingGuard::start(
message_and_format,
self.generic_activity_with_arg(event_label, event_arg),
)
}
/// Start profiling a generic activity. Profiling continues until the
/// TimingGuard returned from this call is dropped.
#[inline(always)]