Skip to main content

Model

Trait Model 

Source
pub trait Model:
    Clone
    + Send
    + Sync
    + 'static {
Show 14 methods // Required methods fn table() -> Table; fn fields() -> Vec<Field>; fn write(&self, w: &mut dyn Writer); fn read(r: &mut dyn Reader) -> Result<Self, StoreError>; fn write_id(&self, w: &mut dyn Writer); fn read_id(&mut self, r: &mut dyn Reader) -> Result<(), StoreError>; // Provided methods fn columns() -> Vec<Name> { ... } fn search() -> Vec<Name> { ... } fn readonly() -> Vec<Name> { ... } fn actions() -> Vec<Action> { ... } fn schema() -> Schema { ... } fn spec() -> Schema { ... } fn row(&self) -> Vec<Value> { ... } fn id(&self) -> Value { ... }
}
Expand description

A domain type mapped to a store table.

Required Methods§

Source

fn table() -> Table

Table this model maps to.

Source

fn fields() -> Vec<Field>

Field definitions for this model’s table.

Source

fn write(&self, w: &mut dyn Writer)

Write all non-id values to the given writer.

Source

fn read(r: &mut dyn Reader) -> Result<Self, StoreError>

Read a new value from the given reader.

Source

fn write_id(&self, w: &mut dyn Writer)

Write just the id values to the given writer.

Source

fn read_id(&mut self, r: &mut dyn Reader) -> Result<(), StoreError>

Read just the id values from the given reader.

Provided Methods§

Source

fn columns() -> Vec<Name>

Names of the plain cell columns.

Source

fn search() -> Vec<Name>

Names of the text columns, used for free-text search.

Source

fn readonly() -> Vec<Name>

Names of the columns the UI shows as read-only.

Source

fn actions() -> Vec<Action>

Actions the UI offers, defaulting to wipe.

Source

fn schema() -> Schema

Schema derived from this model’s table and fields.

Source

fn spec() -> Schema

Full schema including any overriding rules.

Source

fn row(&self) -> Vec<Value>

Cell values of this model in field order.

Source

fn id(&self) -> Value

Key value of this model.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§