Skip to main content

run_flow_cached

Function run_flow_cached 

Source
pub fn run_flow_cached<F: Flow>(
    flow: &mut F,
    cache: &mut Option<(u64, F::View)>,
    world: &mut World,
    bus: &mut LaneBus,
    runtime: &Runtime,
)
Expand description

One Substrate-Pass execution of flow, with view-cache support. This is the body of the [register_flow!] trampoline, extracted so the caching behaviour is a single, directly testable code path.

cache holds the (key, view) pair of the previously published view. When [Flow::cache_key] returns Some(k) equal to the cached key, the cached view is republished (cloned) without re-running select/project; otherwise the flow projects normally and the result replaces the cache (only when caching is enabled — a None key clears it, so a flow can opt out dynamically without risking a stale entry).