pub struct App<R: Renderer, W: Wire, C: Clock> { /* private fields */ }Expand description
The engine: the registry, the instances, the sections — over a
renderer, the wire (for call and live) and a clock.
Implementations§
Source§impl<R: Renderer, W: Wire + Clone + 'static, C: Clock + Clone + 'static> App<R, W, C>
impl<R: Renderer, W: Wire + Clone + 'static, C: Clock + Clone + 'static> App<R, W, C>
Source§impl<R: Renderer, W: Wire + Clone + 'static, C: Clock + Clone + 'static> App<R, W, C>
impl<R: Renderer, W: Wire + Clone + 'static, C: Clock + Clone + 'static> App<R, W, C>
Sourcepub fn set_yield(&self, y: Option<Yield>)
pub fn set_yield(&self, y: Option<Yield>)
FRAME-50: from now on, each section drawn waits its turn, y asking
for it; None fills every section as it is drawn again (the
sections already waiting keep their turns).
Sourcepub fn when_settled(&self, f: Box<dyn FnOnce()>)
pub fn when_settled(&self, f: Box<dyn FnOnce()>)
FRAME-50: f, once no section waits its turn — now, when none does.
Source§impl<R: Renderer, W: Wire + Clone + 'static, C: Clock + Clone + 'static> App<R, W, C>
impl<R: Renderer, W: Wire + Clone + 'static, C: Clock + Clone + 'static> App<R, W, C>
pub fn new(rt: &Runtime, renderer: R, wire: W, clock: C) -> Rc<Self>
Sourcepub fn press(&self, p: &Press) -> bool
pub fn press(&self, p: &Press) -> bool
FRAME-36: a key press — what it matches run, the first chords of a
sequence held, ? the overlay; true when the host took it (the
browser must not have it).
Sourcepub fn provide_module(
&self,
version: &str,
name: &str,
entry: ComponentEntry,
module: Rc<dyn Module<R>>,
)
pub fn provide_module( &self, version: &str, name: &str, entry: ComponentEntry, module: Rc<dyn Module<R>>, )
FRAME-12: version version’s module name, imported, with its
manifest entry; every section waiting on it is filled.
Sourcepub fn cache(&self) -> &Rc<LiveCache<W, C>>
pub fn cache(&self) -> &Rc<LiveCache<W, C>>
The live subscriptions (the page sweeps and reconnects them).
Where a handler’s navigate goes.
Sourcepub fn set_on_need(&self, f: Rc<dyn Fn()>)
pub fn set_on_need(&self, f: Rc<dyn Fn()>)
FRAME-29: what a walk the page did not start (a module’s own DOM changing) calls when it left something to fetch.
Sourcepub fn load(&self, version: &str, manifest: Manifest)
pub fn load(&self, version: &str, manifest: Manifest)
The live version: its hash and manifest. Mounting needs its
components’ files (Self::provide).
Sourcepub fn provide(&self, files: &Files)
pub fn provide(&self, files: &Files)
Files fetched: kept; every section waiting on them is filled.
Sourcepub fn needs(&self) -> Vec<(String, String)>
pub fn needs(&self) -> Vec<(String, String)>
What the engine asks to be fetched: (version, component), each once.
Sourcepub fn sheets(&self) -> BTreeMap<String, usize>
pub fn sheets(&self) -> BTreeMap<String, usize>
FRAME-30: the sheets the page has adopted, by key (<component>@<its sheet's hash or mark>), each with how many instances hold it.
Sourcepub fn mount(
&self,
parent: &R::Node,
name: &str,
props: Map<String, Value>,
) -> Result<MountId, SwapError>
pub fn mount( &self, parent: &R::Node, name: &str, props: Map<String, Value>, ) -> Result<MountId, SwapError>
Mounts name of the live version into a new element (named for it)
appended to parent. A component that fails is drawn as failed (its
element carries data-failed, the version) and the console says why.
Sourcepub fn unmount(&self, id: MountId)
pub fn unmount(&self, id: MountId)
Takes instance id out: its tree or module, its readers, its place
on the bus, the instances in it.
Sourcepub fn update(
&self,
id: MountId,
props: Map<String, Value>,
) -> Result<(), SwapError>
pub fn update( &self, id: MountId, props: Map<String, Value>, ) -> Result<(), SwapError>
FRAME-12: instance id with new props — a route to the component
already drawn. A module hears update(props); an rhx component (its
props are constants in its scope) is drawn again into its element
from its initial state, as a new mount of it was.
Sourcepub fn dispatch(
&self,
id: MountId,
handler: &str,
event: Value,
) -> Result<(), FoldError>
pub fn dispatch( &self, id: MountId, handler: &str, event: Value, ) -> Result<(), FoldError>
Runs handler of instance id on event: its state replaced. The
bus is held while it runs: what it emits is heard once it returned.
Sourcepub fn calls_of(&self, id: MountId) -> usize
pub fn calls_of(&self, id: MountId) -> usize
FRAME-37: how many calls instance id waits on (tests).
Sourcepub fn swap(&self, version: &str, manifest: Manifest) -> SwapReport
pub fn swap(&self, version: &str, manifest: Manifest) -> SwapReport
A new live version: remounts exactly the instances drawn from the live version whose hashes changed; the files of the changed components must be provided first.
Sourcepub fn set_assignments(&self, assignments: Vec<Assignment>)
pub fn set_assignments(&self, assignments: Vec<Assignment>)
The sections’ assignments (ui.slots.list); a section with none
takes manifest.slots’ default.
Sourcepub fn slot_changed(&self, change: Assignment)
pub fn slot_changed(&self, change: Assignment)
slot_changed on ui.watch: that section remounts with its props,
nothing else.
Sourcepub fn slot_reset(&self, layout: &str, slot: &str)
pub fn slot_reset(&self, layout: &str, slot: &str)
slot_changed back to the default (ui.slots.clear).
Sourcepub fn walk(&self, id: MountId)
pub fn walk(&self, id: MountId)
FRAME-18: the walk — module instance id’s element searched for
[data-slot] marks. A section of its whose mark is no longer in the
element (or whose data-slot now names another slot) goes, and what
filled it is destroyed — a mark moved within the element stays its
section. A filled mark whose other data-* attributes changed hands
them to what fills it as update(props), never a refill. A mark
that is no section yet, and is not inside another section within the
element (a mark in a section is the filling component’s), becomes one of the layout id
draws — its slot the attribute’s value, its props the mark’s other
data-* attributes (strings), data-layout written on it — and is
filled as an rhx <slot> is (Self::fill). FRAME-29: a mark
carrying data-component is bound to it (data-version too, when
given) — neither is a prop — and a mark whose binding changed is a
new section, as one whose slot changed.
Sourcepub fn observed(&self, id: MountId, targets: &[R::Node])
pub fn observed(&self, id: MountId, targets: &[R::Node])
FRAME-18: the observer’s batch for module instance id: walked
unless every change was made inside one of its filled sections —
under the mark, not on it (a section’s own drawing, its rows, is none
of the layout’s; the mark’s attributes are).
Sourcepub fn here(&self, name: &str) -> bool
pub fn here(&self, name: &str) -> bool
FRAME-17: whether name of the live version is here to mount: its
files, or its module (a name the manifest lacks is, to be refused).
Sourcepub fn ensure(&self, name: &str) -> bool
pub fn ensure(&self, name: &str) -> bool
FRAME-17: whether name of the live version is here to mount (its
files, or its module); when it is not, it is asked for
(Self::needs).
Sourcepub fn section(&self, layout: &str, slot: &str) -> Option<MountId>
pub fn section(&self, layout: &str, slot: &str) -> Option<MountId>
The instance filling layout’s section slot.
The section menu for layout’s slot, given every stored version
(newest first) with its manifest’s entry for the section’s component.
Sourcepub fn element_of(&self, id: MountId) -> R::Node
pub fn element_of(&self, id: MountId) -> R::Node
Instance id’s element.
Sourcepub fn state_of(&self, id: MountId) -> Map<String, Value>
pub fn state_of(&self, id: MountId) -> Map<String, Value>
Instance id’s state now (a module’s: none).
Sourcepub fn drawn_from(&self, id: MountId) -> (String, String, String)
pub fn drawn_from(&self, id: MountId) -> (String, String, String)
Instance id’s drawn version: (version, tree hash, handlers hash)
— a module’s (version, module hash, "").
Trait Implementations§
Source§impl<R: Renderer, W: Wire + Clone + 'static, C: Clock + Clone + 'static> BusHost for App<R, W, C>
FRAME-12: what the bus asks of the host.
impl<R: Renderer, W: Wire + Clone + 'static, C: Clock + Clone + 'static> BusHost for App<R, W, C>
FRAME-12: what the bus asks of the host.
fn open(&self, method: &str, params: Value, sink: Sink) -> CallId
Source§fn close(&self, call: CallId)
fn close(&self, call: CallId)
fn live(&self, spec: &LiveSpec) -> Reader
Source§fn follow(&self, spec: ModuleSpec) -> ModuleLive
fn follow(&self, spec: ModuleSpec) -> ModuleLive
when, coalesced by
debounce_ms.Source§fn live_version(&self) -> String
fn live_version(&self) -> String
slots_set with no version names it).