Skip to main content

TrendSource

Trait TrendSource 

Source
pub trait TrendSource {
    // Required methods
    fn name(&self) -> &'static str;
    fn collect(
        &self,
        ctx: &CollectCtx,
    ) -> impl Future<Output = Result<CollectReport, TrendError>>;
}
Expand description

A named trend data source.

Object safety is deliberately not a goal: sources are constructed concretely by the CLI and dispatched by an enum there, which keeps the trait compatible with async-fn-in-trait.

Required Methods§

Source

fn name(&self) -> &'static str

Stable source identifier used in collect_runs.

Source

fn collect( &self, ctx: &CollectCtx, ) -> impl Future<Output = Result<CollectReport, TrendError>>

Run one collection pass, writing snapshots into ctx.store.

The returned future is deliberately not Send: collection is sequential by design (API pacing) and the SQLite connection must stay confined to the collecting task.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§