Skip to main content

RowField

Struct RowField 

Source
pub struct RowField {
    pub meta: Meta,
    pub key: String,
    pub kind: FieldKind,
    pub choices: Vec<RowChoice>,
    pub choices_key: Option<String>,
    pub command: String,
    pub args: Value,
}
Expand description

An editable cell: a record’s value shown as a field (a toggle, a text, a choice) and written through a command whose arguments name the record (${row.<key>}) and the new value (${value}). In a table it takes the place of the column of its key, or adds one; in a list it shows under the record’s title. Its when and enabled read the record as row.<key>; its description is its tooltip.

Fields§

§meta: Meta§key: String

The record’s key it shows.

§kind: FieldKind

toggle, text or choice; another kind shows as text.

§choices: Vec<RowChoice>§choices_key: Option<String>

The choices from the record: an array of {value, label} at this key (destinations that depend on the record).

§command: String§args: Value

Implementations§

Source§

impl RowField

Source

pub fn toggle(key: &str, title: &str, command: &str, args: Json) -> RowField

A switch over a boolean.

Source

pub fn text(key: &str, title: &str, command: &str, args: Json) -> RowField

A text, written when the field is left or Enter is pressed.

Source

pub fn choice( key: &str, title: &str, choices: &[(Json, &str)], command: &str, args: Json, ) -> RowField

One of the choices (value, label).

Source

pub fn choices_from(self, key: &str) -> RowField

The choices read from the record at key.

Source

pub fn id(self, id: &str) -> RowField

Its id, when two fields show the same key.

Source

pub fn help(self, text: &str) -> RowField

Its tooltip.

Source

pub fn choices_of(&self, row: &Json) -> Vec<RowChoice>

The choices offered for a record: the declared ones, then those the record holds.

Source

pub fn write_args(&self, values: &Values, value: Json) -> Json

The command’s arguments for a new value: the template filled with the values (the record’s as row.<key>) and value.

Trait Implementations§

Source§

impl Clauses for RowField

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 RowField

Source§

fn clone(&self) -> RowField

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 RowField

Source§

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

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

impl<'de> Deserialize<'de> for RowField

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 RowField

Source§

fn eq(&self, other: &RowField) -> 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 RowField

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 RowField

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>,