Skip to main content

RecorderSourceExt

Trait RecorderSourceExt 

pub trait RecorderSourceExt: Sized {
    // Required methods
    fn source(self, source: impl Source + 'static) -> Self;
    fn on_recording_start(
        self,
        hook: impl FnOnce(&Dial9Handle) + Send + 'static,
    ) -> Self;
    fn on_recording_thread_start<F, T>(self, hook: F) -> Self
       where F: Fn() -> T + Send + Sync + 'static,
             T: FnOnce() + Send + 'static;

    // Provided method
    fn with_custom_events<F>(
        self,
        config: CustomEventsConfig,
        callback: F,
    ) -> Self
       where F: for<'a> FnMut(&mut CustomEventsContext<'a>) + Send + 'static { ... }
}
Available on crate feature dial9 only.
Expand description

A builder that can register Sources.

Implemented by RecorderBuilder; the .with_*() perf-source sugar is built on top of it.

Required Methods§

fn source(self, source: impl Source + 'static) -> Self

Register a Source with the underlying recording recorder.

fn on_recording_start( self, hook: impl FnOnce(&Dial9Handle) + Send + 'static, ) -> Self

Register a hook run once, with the live Dial9Handle, when the recorder starts recording.

fn on_recording_thread_start<F, T>(self, hook: F) -> Self
where F: Fn() -> T + Send + Sync + 'static, T: FnOnce() + Send + 'static,

Register a hook run on each of dial9’s own threads (the flush thread and, with pipeline, the background worker) before it starts, returning a teardown run when it stops. Defaults to a no-op.

Provided Methods§

fn with_custom_events<F>(self, config: CustomEventsConfig, callback: F) -> Self
where F: for<'a> FnMut(&mut CustomEventsContext<'a>) + Send + 'static,

Register a callback that dial9 invokes on the flush thread at the config’s interval to emit custom events. Sugar for source with a CustomEventsSource. Not tokio-coupled — works on the plain recorder and the tokio builder.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§