Skip to main content

Runtime

Struct Runtime 

Source
pub struct Runtime { /* private fields */ }
Expand description

A renderer’s surfaces, headless.

Implementations§

Source§

impl Runtime

Source

pub fn new( catalogs: impl IntoIterator<Item = Catalog>, ) -> Result<Self, CompileError>

A runtime for a renderer that supports catalogs.

Source

pub fn basic() -> Self

A runtime for the basic catalog alone.

Source

pub fn set_rules(&mut self, rules: Rules)

The completeness rules batches are applied under from now on (see crate::Rules; strict by default).

Source

pub fn register( &mut self, name: impl Into<String>, def: FunctionDef, function: LocalFunction, )

Implement a function on the renderer (see Evaluator::register).

Source

pub fn surface_ids(&self) -> impl Iterator<Item = &str>

The surfaces, by id.

Source

pub fn data_model(&self, surface_id: &str) -> Option<&Value>

A surface’s data model.

Source

pub fn components( &self, surface_id: &str, ) -> Option<impl Iterator<Item = &Value>>

A surface’s components as the agent sent them (the latest of each id).

Source

pub fn surface_metadata(&self, surface_id: &str) -> Option<&Value>

A surface’s metadata from createSurface (its extensions).

Source

pub fn sends_data_model(&self, surface_id: &str) -> bool

Whether the surface asked for its data model with every message.

Source

pub fn snapshot(&self) -> Vec<Value>

Each surface as the one createSurface message that draws it as it is now: its catalog, sendDataModel when set, its components (the latest of each id, by id), and its data model. A renderer that reopens, or joins late, can be brought up to date with these alone, in surface id order.

Source

pub fn capabilities(&self, inline: bool) -> Value

The renderer’s capabilities (renderer_capabilities.json): the ids of its catalogs and, with inline, the catalog documents themselves.

Source

pub fn renderer_data_model(&self) -> Option<Value>

The renderer data model to send with a message (renderer_data_model.json): the surfaces that set sendDataModel, or None if none did.

Source

pub fn apply(&mut self, messages: &[Value]) -> Report

Validate and apply a batch, all or nothing. See the module docs.

Source

pub fn tree(&self, surface_id: &str) -> Option<Node>

Resolve a surface for drawing, from its root (None when the surface does not exist or has no root yet).

Source

pub fn node(&self, surface_id: &str, component_id: &str) -> Option<Node>

Resolve one component at the root data context, whether or not it is reachable from root.

Source

pub fn input( &mut self, surface_id: &str, path: &str, value: Value, ) -> Result<(), DataError>

Write what the user entered at an absolute data model path (two-way binding): the input component’s bound path, resolved against its node’s data context.

Source

pub fn dispatch( &mut self, action: &Value, gesture: &Gesture, ) -> Result<Dispatch, ActionError>

Run an action (a component’s action property, as sent) for a gesture: an event becomes the action message to send, with its context resolved; a function call runs locally, its data writes applied and its other effects returned.

Trait Implementations§

Source§

impl Debug for Runtime

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Runtime

§

impl !UnwindSafe for Runtime

§

impl Forget for Runtime

§

impl Freeze for Runtime
where *const u8 is !null: Freeze, PhantomData<Entry>: Freeze, *const LeafNode<String, Surface> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(String, Surface)>>: Freeze, PhantomData<Catalog>: Freeze, PhantomData<(String, FunctionDef, Arc<dyn Fn(&Map<String, Value>, &Scope<'_>) -> Result<Value, String> + Send + Sync>)>: Freeze, *const LeafNode<String, SurfaceState> is !null: Freeze, PhantomData<Box<(String, SurfaceState)>>: Freeze,

§

impl Move for Runtime

§

impl Send for Runtime
where RawVecInner: Send, RawTable<usize>: Send, NodeRef<Owned, String, ComponentDef, LeafOrInternal>: Send, BoxRaw<(String, ComponentDef)>: Send, NodeRef<Owned, String, FunctionDef, LeafOrInternal>: Send, BoxRaw<(String, FunctionDef)>: Send, Arc<SchemaNodeInner<SerdeJson>>: Send, Arc<str>: Send, &'static str: Send, NodeRef<Owned, String, Surface, LeafOrInternal>: Send, BoxRaw<(String, Surface)>: Send, Arc<dyn Fn(&Map<String, Value>, &Scope<'_>) -> Result<Value, String> + Send + Sync>: Send, NodeRef<Owned, String, SurfaceState, LeafOrInternal>: Send, BoxRaw<(String, SurfaceState)>: Send,

§

impl Sync for Runtime
where RawVecInner: Sync, RawTable<usize>: Sync, NodeRef<Owned, String, ComponentDef, LeafOrInternal>: Sync, BoxRaw<(String, ComponentDef)>: Sync, NodeRef<Owned, String, FunctionDef, LeafOrInternal>: Sync, BoxRaw<(String, FunctionDef)>: Sync, Arc<SchemaNodeInner<SerdeJson>>: Sync, Arc<str>: Sync, NodeRef<Owned, String, Surface, LeafOrInternal>: Sync, BoxRaw<(String, Surface)>: Sync, Arc<dyn Fn(&Map<String, Value>, &Scope<'_>) -> Result<Value, String> + Send + Sync>: Sync, NodeRef<Owned, String, SurfaceState, LeafOrInternal>: Sync, BoxRaw<(String, SurfaceState)>: Sync,

§

impl Unpin for Runtime
where *const u8 is !null: Unpin, *const LeafNode<String, ComponentDef> is !null: Unpin, Box<(String, ComponentDef)>: Unpin, *const LeafNode<String, FunctionDef> is !null: Unpin, Box<(String, FunctionDef)>: Unpin, Arc<SchemaNodeInner<SerdeJson>>: Unpin, Arc<str>: Unpin, &'static str: Unpin, *const LeafNode<String, Surface> is !null: Unpin, Box<(String, Surface)>: Unpin, Arc<dyn Fn(&Map<String, Value>, &Scope<'_>) -> Result<Value, String> + Send + Sync>: Unpin, *const LeafNode<String, SurfaceState> is !null: Unpin, Box<(String, SurfaceState)>: Unpin,

§

impl UnsafeUnpin for Runtime
where *const u8 is !null: UnsafeUnpin, PhantomData<Entry>: UnsafeUnpin, *const LeafNode<String, Surface> is !null: UnsafeUnpin, PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin, PhantomData<Box<(String, Surface)>>: UnsafeUnpin, PhantomData<Catalog>: UnsafeUnpin, PhantomData<(String, FunctionDef, Arc<dyn Fn(&Map<String, Value>, &Scope<'_>) -> Result<Value, String> + Send + Sync>)>: UnsafeUnpin, *const LeafNode<String, SurfaceState> is !null: UnsafeUnpin, PhantomData<Box<(String, SurfaceState)>>: 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, 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.