Skip to main content

App

Struct App 

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

Source

pub fn reachable(&self, component: &str) -> Vec<String>

The live version’s components the route to component mounts: it, its sections’ components and every component their trees name.

Source

pub fn boot_specs( &self, component: &str, props: Map<String, Value>, ) -> Vec<LiveSpec>

The live specs the route to component with props asks first (see the module’s words), in the order they are opened.

Source§

impl<R: Renderer, W: Wire + Clone + 'static, C: Clock + Clone + 'static> App<R, W, C>

Source

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

Source

pub fn when_settled(&self, f: Box<dyn FnOnce()>)

FRAME-50: f, once no section waits its turn — now, when none does.

Source

pub fn queued(&self) -> usize

FRAME-50: how many sections wait their turn.

Source

pub fn release(&self)

FRAME-50: every section held drawn — its attribute taken off, the sheet down — in one change, so the page lays them out together.

Source

pub fn held(&self) -> usize

FRAME-50: how many sections are held.

Source§

impl<R: Renderer, W: Wire + Clone + 'static, C: Clock + Clone + 'static> App<R, W, C>

Source

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

Source

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

Source

pub fn bus(&self) -> Bus

FRAME-12: the page’s bus.

Source

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.

Source

pub fn cache(&self) -> &Rc<LiveCache<W, C>>

The live subscriptions (the page sweeps and reconnects them).

Source

pub fn set_navigate(&self, f: Rc<dyn Fn(&str)>)

Where a handler’s navigate goes.

Source

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.

Source

pub fn load(&self, version: &str, manifest: Manifest)

The live version: its hash and manifest. Mounting needs its components’ files (Self::provide).

Source

pub fn version(&self) -> String

The live version’s hash.

Source

pub fn manifest(&self) -> Manifest

The live version’s manifest.

Source

pub fn provide(&self, files: &Files)

Files fetched: kept; every section waiting on them is filled.

Source

pub fn needs(&self) -> Vec<(String, String)>

What the engine asks to be fetched: (version, component), each once.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn calls_of(&self, id: MountId) -> usize

FRAME-37: how many calls instance id waits on (tests).

Source

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.

Source

pub fn set_assignments(&self, assignments: Vec<Assignment>)

The sections’ assignments (ui.slots.list); a section with none takes manifest.slots’ default.

Source

pub fn slot_changed(&self, change: Assignment)

slot_changed on ui.watch: that section remounts with its props, nothing else.

Source

pub fn slot_reset(&self, layout: &str, slot: &str)

slot_changed back to the default (ui.slots.clear).

Source

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.

Source

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

Source

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

Source

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

Source

pub fn section(&self, layout: &str, slot: &str) -> Option<MountId>

The instance filling layout’s section slot.

Source

pub fn sections(&self) -> Vec<(String, String)>

The sections drawn: (layout, slot) each.

Source

pub fn menu( &self, layout: &str, slot: &str, versions: &[(String, Option<ComponentEntry>)], ) -> Menu

The section menu for layout’s slot, given every stored version (newest first) with its manifest’s entry for the section’s component.

Source

pub fn instances(&self) -> Vec<(MountId, String)>

Every instance mounted: (id, name).

Source

pub fn element_of(&self, id: MountId) -> R::Node

Instance id’s element.

Source

pub fn props_of(&self, id: MountId) -> Map<String, Value>

Instance id’s props.

Source

pub fn state_of(&self, id: MountId) -> Map<String, Value>

Instance id’s state now (a module’s: none).

Source

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

Source

pub fn name_of(&self, id: MountId) -> Option<String>

FRAME-12: the name instance id draws, while it is mounted.

Source

pub fn console(&self) -> Vec<String>

What the engine said on the console, in order.

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.

Source§

fn open(&self, method: &str, params: Value, sink: Sink) -> CallId

Source§

fn close(&self, call: CallId)

GAMMA-6: stops a call on the wire (an unsubscribe); its sink hears nothing more.
Source§

fn live(&self, spec: &LiveSpec) -> Reader

Source§

fn follow(&self, spec: ModuleSpec) -> ModuleLive

FRAME-19: a module’s collection, held by when, coalesced by debounce_ms.
Source§

fn navigate(&self, route: &str)

Source§

fn live_version(&self) -> String

The live version’s hash (slots_set with no version names it).
Source§

fn bound(&self, layout: &str, slot: &str) -> Option<String>

FRAME-29: the component a mark binds layout’s slot to, when one does — slots_set on it is refused bound.
Source§

impl<R: Renderer, W: Wire, C: Clock> Drop for App<R, W, C>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<R, W, C> !Freeze for App<R, W, C>

§

impl<R, W, C> !RefUnwindSafe for App<R, W, C>

§

impl<R, W, C> !Send for App<R, W, C>

§

impl<R, W, C> !Sync for App<R, W, C>

§

impl<R, W, C> !UnwindSafe for App<R, W, C>

§

impl<R, W, C> Forget for App<R, W, C>

§

impl<R, W, C> Move for App<R, W, C>

§

impl<R, W, C> Unpin for App<R, W, C>
where R: Unpin, W: Unpin, Rc<LiveCache<W, C>>: Unpin, RefCell<St<R>>: Unpin, Turns<<R as Renderer>::Node>: Unpin, Weak<App<R, W, C>>: Unpin,

§

impl<R, W, C> UnsafeUnpin for App<R, W, C>
where R: UnsafeUnpin, W: UnsafeUnpin, Rc<LiveCache<W, C>>: UnsafeUnpin, RefCell<St<R>>: UnsafeUnpin, Turns<<R as Renderer>::Node>: UnsafeUnpin, Weak<App<R, W, C>>: UnsafeUnpin,

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.