Skip to main content

Logic

Trait Logic 

Source
pub trait Logic: Sized + 'static {
    type Frame: 'static;
    type Value: Clone + Debug + 'static;
    type Binding: Clone + Debug + 'static;
    type Action: Clone + Debug + 'static;
    type Region: Debug + 'static;
    type Error: 'static;

Show 15 methods // Required methods fn text( &self, text: &Self::Value, frame: &Self::Frame, ) -> Result<String, Self::Error>; fn number( &self, number: &Self::Value, frame: &Self::Frame, ) -> Result<i64, Self::Error>; fn flag( &self, flag: &Self::Value, frame: &Self::Frame, ) -> Result<bool, Self::Error>; fn texts( &self, texts: &Self::Value, frame: &Self::Frame, ) -> Result<Vec<String>, Self::Error>; fn read_text( &self, binding: &Self::Binding, frame: &Self::Frame, ) -> Result<String, Self::Error>; fn read_checked( &self, binding: &Self::Binding, frame: &Self::Frame, ) -> Result<bool, Self::Error>; fn read_number( &self, binding: &Self::Binding, frame: &Self::Frame, ) -> Result<i64, Self::Error>; fn write_text( &self, binding: &Self::Binding, frame: &Self::Frame, text: &str, ) -> Result<(), Self::Error>; fn write_checked( &self, binding: &Self::Binding, frame: &Self::Frame, checked: bool, ) -> Result<(), Self::Error>; fn write_number( &self, binding: &Self::Binding, frame: &Self::Frame, number: i64, ) -> Result<(), Self::Error>; fn write_texts( &self, binding: &Self::Binding, frame: &Self::Frame, texts: Vec<String>, ) -> Result<(), Self::Error>; fn run( &self, action: &Self::Action, frame: &Self::Frame, ) -> Result<(), Self::Error>; fn expand( &self, region: &Self::Region, frame: &Rc<Self::Frame>, ) -> Result<Vec<Shown<Self>>, Self::Error>; fn take_changed(&self) -> StateSet; fn take_window_requests(&self) -> Vec<WindowRequest>;
}
Expand description

The program behind an app’s UI. Templates hold its handles to values, bindings, actions and regions, and the engine asks it to evaluate them against a frame of locals.

The interpreter implements it by walking checked code, and compiled apps by calling compiled functions.

Required Associated Types§

Source

type Frame: 'static

The locals visible to a piece of UI, such as loop variables and view parameters.

Source

type Value: Clone + Debug + 'static

A value the UI shows, or reads when the user acts, such as a label’s text or a nav item’s value. Each is read as the type the checker gave it.

Source

type Binding: Clone + Debug + 'static

A place a text field or checkbox shows, and writes the user’s edits to.

Source

type Action: Clone + Debug + 'static

What a button does when clicked.

Source

type Region: Debug + 'static

An if, for or view call: UI whose shape depends on state.

Source

type Error: 'static

Required Methods§

Source

fn text( &self, text: &Self::Value, frame: &Self::Frame, ) -> Result<String, Self::Error>

§Errors

When evaluating the text fails.

Source

fn number( &self, number: &Self::Value, frame: &Self::Frame, ) -> Result<i64, Self::Error>

§Errors

When evaluating the number fails.

Source

fn flag( &self, flag: &Self::Value, frame: &Self::Frame, ) -> Result<bool, Self::Error>

§Errors

When evaluating the flag fails.

Source

fn texts( &self, texts: &Self::Value, frame: &Self::Frame, ) -> Result<Vec<String>, Self::Error>

§Errors

When evaluating the list fails.

Source

fn read_text( &self, binding: &Self::Binding, frame: &Self::Frame, ) -> Result<String, Self::Error>

§Errors

When reading the bound place fails.

Source

fn read_checked( &self, binding: &Self::Binding, frame: &Self::Frame, ) -> Result<bool, Self::Error>

§Errors

When reading the bound place fails.

Source

fn read_number( &self, binding: &Self::Binding, frame: &Self::Frame, ) -> Result<i64, Self::Error>

§Errors

When reading the bound place fails.

Source

fn write_text( &self, binding: &Self::Binding, frame: &Self::Frame, text: &str, ) -> Result<(), Self::Error>

§Errors

When writing the bound place fails.

Source

fn write_checked( &self, binding: &Self::Binding, frame: &Self::Frame, checked: bool, ) -> Result<(), Self::Error>

§Errors

When writing the bound place fails.

Source

fn write_number( &self, binding: &Self::Binding, frame: &Self::Frame, number: i64, ) -> Result<(), Self::Error>

§Errors

When writing the bound place fails.

Source

fn write_texts( &self, binding: &Self::Binding, frame: &Self::Frame, texts: Vec<String>, ) -> Result<(), Self::Error>

§Errors

When writing the bound place fails.

Source

fn run( &self, action: &Self::Action, frame: &Self::Frame, ) -> Result<(), Self::Error>

§Errors

When the action fails part-way.

Source

fn expand( &self, region: &Self::Region, frame: &Rc<Self::Frame>, ) -> Result<Vec<Shown<Self>>, Self::Error>

What region shows now, in order: lists of templates, each with its own frame.

§Errors

When evaluating what decides the region’s contents fails.

Source

fn take_changed(&self) -> StateSet

The states changed since the last call.

Source

fn take_window_requests(&self) -> Vec<WindowRequest>

What code asked of the app’s windows since the last call, in order.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§