pub struct LiveCache<W: Wire, C: Clock> { /* private fields */ }Expand description
Every live subscription of the page.
Implementations§
Source§impl<W: Wire + Clone + 'static, C: Clock + Clone + 'static> LiveCache<W, C>
impl<W: Wire + Clone + 'static, C: Clock + Clone + 'static> LiveCache<W, C>
pub fn new(rt: &Runtime, wire: W, clock: C) -> Rc<Self>
Sourcepub fn running(&self) -> usize
pub fn running(&self) -> usize
FRAME-50: how many snapshots are asked and not yet answered (done, refused or failed).
Sourcepub fn when_answered(&self, f: Box<dyn FnOnce()>)
pub fn when_answered(&self, f: Box<dyn FnOnce()>)
FRAME-50: f once every snapshot running now is answered (or let
go) — now, when none is; one asked later is not waited for.
Sourcepub fn acquire(self: &Rc<Self>, spec: &LiveSpec) -> Reader
pub fn acquire(self: &Rc<Self>, spec: &LiveSpec) -> Reader
A reader of spec’s collection: the subscription kept for it, else
a new one (changes opened, then the snapshot).
Sourcepub fn flush(&self)
pub fn flush(&self)
STUDIO-16: the frame — every collection with changes waiting published, its readers drawn once (one batch: a binding reading several runs once).
Sourcepub fn reconnected(&self)
pub fn reconnected(&self)
The socket came back: every kept subscription resyncing, its
changes re-opened and its snapshot asked again.
Source§impl<W: Wire + Clone + 'static, C: Clock + Clone + 'static> LiveCache<W, C>
impl<W: Wire + Clone + 'static, C: Clock + Clone + 'static> LiveCache<W, C>
Sourcepub fn follow(
self: &Rc<Self>,
query: LiveQuery,
params: impl FnMut() -> (Value, Value) + 'static,
) -> Follow
pub fn follow( self: &Rc<Self>, query: LiveQuery, params: impl FnMut() -> (Value, Value) + 'static, ) -> Follow
UI-10: a collection whose params are params() — (params, changes_params), read in a binding: when a signal it read changes,
the snapshot runs again (after debounce_ms of quiet when given),
the old rows kept, resyncing, until the new snapshot lands.
Sourcepub fn follow_held(
self: &Rc<Self>,
query: LiveQuery,
params: impl FnMut() -> Option<(Value, Value)> + 'static,
) -> Follow
pub fn follow_held( self: &Rc<Self>, query: LiveQuery, params: impl FnMut() -> Option<(Value, Value)> + 'static, ) -> Follow
FRAME-16: Self::follow, held while params() answers None (its
when is false): nothing is asked, and a reader it held is let go —
the rows stay as they were; answered again, it runs with the params
of that moment — after debounce_ms when it has one (a query typed
into a held palette is one call, not one per key).
Source§impl<W: Wire + Clone + 'static, C: Clock + Clone + 'static> LiveCache<W, C>
impl<W: Wire + Clone + 'static, C: Clock + Clone + 'static> LiveCache<W, C>
Sourcepub fn follow_module(self: &Rc<Self>, spec: ModuleSpec) -> ModuleLive
pub fn follow_module(self: &Rc<Self>, spec: ModuleSpec) -> ModuleLive
FRAME-19: a module’s collection, held by its when and its param
changes coalesced by its debounce_ms — rhx’s Self::follow_held,
its inputs a signal ModuleLive::update sets.