Skip to main content

Records

Struct Records 

Source
pub struct Records {
    pub meta: Meta,
    pub source: RecordSource,
    pub key: String,
    pub title_key: Option<String>,
    pub subtitle_key: Option<String>,
    pub columns: Vec<Column>,
    pub tone_key: Option<String>,
    pub row_fields: Vec<RowField>,
    pub row_actions: Vec<Action>,
    pub empty: Option<Empty>,
    pub refresh: Vec<String>,
    pub detail: Option<Detail>,
}
Expand description

A record list or table: rows read from a source, each with its actions (${row.<key>} in their arguments).

Fields§

§meta: Meta§source: RecordSource§key: String

The record’s id (its key in a row action’s ${row.<key>}).

§title_key: Option<String>

A list: the title and subtitle keys; a table: unused.

§subtitle_key: Option<String>§columns: Vec<Column>

A table’s columns; a list’s trailing values.

§tone_key: Option<String>

A key whose value (info, success, warning, danger, muted) tones the row.

§row_fields: Vec<RowField>§row_actions: Vec<Action>§empty: Option<Empty>§refresh: Vec<String>

Event kinds after which it is read again (storage.*).

§detail: Option<Detail>

A row’s detail sheet: a Details button on each row opens it.

Implementations§

Source§

impl Records

Source

pub fn command( id: &str, title: &str, command: &str, pointer: &str, key: &str, ) -> Records

Records a read_only command answers (an array at pointer).

Source

pub fn hook(id: &str, title: &str, hook: &str, key: &str) -> Records

Records a records hook gives.

Source

pub fn args(self, args: Json) -> Records

The read command’s arguments.

Source

pub fn titles(self, title: &str, subtitle: Option<&str>) -> Records

A list item’s title and subtitle keys.

Source

pub fn column(self, key: &str, title: &str) -> Records

Source

pub fn meter(self, key: &str, title: &str, text: &str) -> Records

A meter column: the share at key (0 to 1), the words at text.

Source

pub fn icon(self, key: &str, title: &str, tip: Option<&str>) -> Records

An icon column: the IconCell at key, its tooltip (when the value is a bare name) at tip.

Source

pub fn row_field(self, field: RowField) -> Records

An editable cell (RowField).

Source

pub fn field_for(&self, key: &str) -> Option<&RowField>

The row field shown in place of a column, by its key.

Source

pub fn extra_fields(&self) -> impl Iterator<Item = &RowField>

The row fields with no column of their key: a table adds a column for each.

Source

pub fn tone(self, key: &str) -> Records

Source

pub fn row_action(self, action: Action) -> Records

Source

pub fn empty(self, text: &str, action: Option<Action>) -> Records

Source

pub fn refresh(self, event: &str) -> Records

Source

pub fn detail(self, detail: Detail) -> Records

A detail sheet for each row (Detail): a Details button on the row opens it.

Source

pub fn row_title(&self, row: &Json) -> String

A row’s title: its value at the list’s title key, else at the first column’s key, else its id.

Source

pub fn detail_title(&self, row: &Json) -> String

A detail sheet’s title for a row: its value at the sheet’s title key, else the row’s title.

Source

pub fn rows_of(answer: &Json, pointer: &str) -> Vec<Json>

The rows in a source’s answer: the array at the pointer, its objects only; an object there is one record (a form over one record, as a strategy).

Source

pub fn row_values(values: &Values, row: &Json) -> Values

The values a row’s actions and fields read: the form’s, and the record’s as row.<key>.

Trait Implementations§

Source§

impl Clauses for Records

Source§

fn meta_mut(&mut self) -> &mut Meta

Source§

fn when(self, clause: &str) -> Self

Shown only when the clause holds (the when language; the section’s values as form.<field id>).
Source§

fn enabled(self, clause: &str, reason: &str) -> Self

Greyed, with its reason, when the clause does not hold.
Source§

impl Clone for Records

Source§

fn clone(&self) -> Records

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Records

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Records

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Records

Source§

fn eq(&self, other: &Records) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Records

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Records

Auto Trait Implementations§

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,