Skip to main content

AsyncTick

Trait AsyncTick 

Source
pub trait AsyncTick<Ctx = ()> {
    type Info;
    type Error;

    // Required method
    fn tick(
        &mut self,
        grants: &mut Ctx,
    ) -> impl Future<Output = Result<Self::Info, Self::Error>> + Send;
}
Available on crate feature runtime only.
Expand description

WHAT A MOUNTED CLOCK RUNS — the async citizen a poll(…) entry names with handler = "…".

Ctx is what the clock LENDS the tick, and it defaults to (): an entry that granted nothing lends nothing, and a handler for it writes impl AsyncTick for Scraper with no context named. An entry that wrote write = "…" lends its own emitted grants context, so its handler names that type — impl AsyncTick<ExporterScrapeGrants<Rows>> for Scraper — and the write sockets it reaches are exactly the grants that entry wrote.

§Why the citizen is not the operator

Because a node’s clocks and a node’s data path are two different concerns wearing one struct. A light entry is a method on the operator and stays the road for a sweep that works through the node’s own state; a mounted handler is a value the DEPLOYMENT built and handed over, which is what makes a scraper, an exporter or a health probe reusable across declarations and testable without a resident. Both roads stay open, entry by entry, which is what the presence split buys.

§The answer is a Send future, spelled rather than hoped for

AsyncLands::land’ reason verbatim: a resident is a task on somebody’s runtime, so a body it awaits has to cross threads. Writing the bound into the signature makes it part of the contract instead of something each caller discovers.

Required Associated Types§

Source

type Info

What one tick has to say about itself — the info the observation it becomes carries.

Bound-free here, as Seats::Info is: the erasure a tap needs costs Any + Send + Sync, and the driver asks for it at its own call site.

Source

type Error

What a tick can fail with. Bound-free for Info’s reason.

Required Methods§

Source

fn tick( &mut self, grants: &mut Ctx, ) -> impl Future<Output = Result<Self::Info, Self::Error>> + Send

Run one tick, through what this clock was lent.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§