Skip to main content

LiveCache

Struct LiveCache 

Source
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>

Source

pub fn new(rt: &Runtime, wire: W, clock: C) -> Rc<Self>

Source

pub fn running(&self) -> usize

FRAME-50: how many snapshots are asked and not yet answered (done, refused or failed).

Source

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.

Source

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).

Source

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).

Source

pub fn sweep(&self)

Closes every subscription with no reader for longer than KEEP_MS.

Source

pub fn reconnected(&self)

The socket came back: every kept subscription resyncing, its changes re-opened and its snapshot asked again.

Source

pub fn kept(&self) -> usize

How many subscriptions are kept (read or waiting out their 5 s).

Source§

impl<W: Wire + Clone + 'static, C: Clock + Clone + 'static> LiveCache<W, C>

Source

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.

Source

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>

Source

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.

Auto Trait Implementations§

§

impl<W, C> !Freeze for LiveCache<W, C>

§

impl<W, C> !RefUnwindSafe for LiveCache<W, C>

§

impl<W, C> !Send for LiveCache<W, C>

§

impl<W, C> !Sync for LiveCache<W, C>

§

impl<W, C> !UnwindSafe for LiveCache<W, C>

§

impl<W, C> Forget for LiveCache<W, C>

§

impl<W, C> Move for LiveCache<W, C>

§

impl<W, C> Unpin for LiveCache<W, C>
where W: Unpin, C: Unpin, Weak<LiveCache<W, C>>: Unpin,

§

impl<W, C> UnsafeUnpin for LiveCache<W, C>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.