Skip to main content

Host

Trait Host 

Source
pub trait Host {
    // Required methods
    fn call(&self, method: &str, params: Value);
    fn navigate(&self, route: &str);

    // Provided methods
    fn call_then(&self, method: &str, params: Value, fold: &str) { ... }
    fn emit(&self, topic: &str, data: Value) -> Result<(), String> { ... }
    fn last(&self, topic: &str) -> Value { ... }
    fn slots_set(
        &self,
        layout: &str,
        slot: &str,
        component: &str,
        version: Option<&str>,
    ) -> Result<(), String> { ... }
}
Expand description

What a handler reaches: the engine’s call and navigate.

Required Methods§

Source

fn call(&self, method: &str, params: Value)

A Plexus call through the engine’s one socket (its answer is not the handler’s: a live collection hears the change).

Source

fn navigate(&self, route: &str)

Moves the page to route (#/ticket/T-1).

Provided Methods§

Source

fn call_then(&self, method: &str, params: Value, fold: &str)

FRAME-37: call(method, params, "fold") — the call sent once, and fold run once when its stream ends, with the answer (crate::bus::Answer) and the call on ev. A host that runs no fold sends it as Self::call.

Source

fn emit(&self, topic: &str, data: Value) -> Result<(), String>

FRAME-12: data on the bus’s topic; a refusal’s words.

Source

fn last(&self, topic: &str) -> Value

FRAME-53: bus_last(topic) — the topic’s kept event, null when none.

Source

fn slots_set( &self, layout: &str, slot: &str, component: &str, version: Option<&str>, ) -> Result<(), String>

FRAME-12: ui.slots.set, held to the component’s uses.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§