Skip to main content

EntityInfo

Struct EntityInfo 

Source
#[non_exhaustive]
pub struct EntityInfo {
Show 23 fields pub name: String, pub caption: String, pub navigation: Option<String>, pub icon: Option<String>, pub fields: Vec<FieldInfo>, pub rules: Vec<Rule>, pub appearance: Vec<AppearanceRule>, pub variants: Vec<ViewVariant>, pub description: Option<String>, pub state_machines: Vec<StateMachine>, pub reminder: Option<Reminder>, pub actions: Vec<RecordAction>, pub editor_settings: Vec<(String, String, String)>, pub form_columns: Option<u8>, pub filters: Vec<ListFilter>, pub list_criteria: Option<String>, pub cloneable: bool, pub transient: bool, pub checks_on_leave: bool, pub list_editable: bool, pub data_access: DataAccess, pub form_actions: Vec<String>, pub focus_order: Vec<String>,
}
Expand description

A kind of record.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§name: String

Its name, in the model and in code.

§caption: String

What people see. Follows from the name unless given.

§navigation: Option<String>

The group it goes under in the navigation; without one, it stays out.

§icon: Option<String>

The name of its icon.

§fields: Vec<FieldInfo>

Its fields, in the order they were declared.

§rules: Vec<Rule>

What its records have to meet.

§appearance: Vec<AppearanceRule>

How things look and behave by what its records hold.

§variants: Vec<ViewVariant>

The ways to see its list.

§description: Option<String>

What its list says it is there for, above the records.

§state_machines: Vec<StateMachine>

The states its records go through.

§reminder: Option<Reminder>

When to remind people of a record.

§actions: Vec<RecordAction>

Actions that set fields of the records selected.

§editor_settings: Vec<(String, String, String)>

What the list editors are told about this list: an editor’s settings node, and in it names and values.

§form_columns: Option<u8>

How many columns its form’s fields go in; by how many there are, unless given.

§filters: Vec<ListFilter>

The filters people pick from on its list.

§list_criteria: Option<String>

What every record its list shows has to meet.

§cloneable: bool

Its records can be cloned.

§transient: bool

Its records are not kept by any storage: they live on a form or in a list given to them.

§checks_on_leave: bool

A form says what is wrong with a field as it is left, and not only on saving.

§list_editable: bool

People can change values right on its list.

§data_access: DataAccess

How its list gets its records.

§form_actions: Vec<String>

Places on its form for actions, by the name of their ActionCategory::InForm.

§focus_order: Vec<String>

The fields its form goes through first with the keyboard, in this order. The form shows them in the same order, so the eye and the keyboard go the same way.

Implementations§

Source§

impl EntityInfo

Source

pub fn appearance_of( &self, target: AppearanceTarget, name: &str, view: &ViewInfo, object: Option<&Object>, ) -> Appearance

What this entity’s rules say about a thing in a view, for a record.

Source§

impl EntityInfo

Source

pub fn new(name: impl Into<String>) -> Self

An entity with no fields yet.

Source

pub fn caption(self, caption: impl Into<String>) -> Self

What people see.

Source

pub fn navigation(self, group: impl Into<String>) -> Self

The group it goes under in the navigation.

Source

pub fn icon(self, icon: impl Into<String>) -> Self

The name of its icon.

Source

pub fn field(self, field: FieldInfo) -> Self

Appends a field.

Source

pub fn rule(self, rule: Rule) -> Self

Appends something its records have to meet.

Source

pub fn appearance(self, rule: AppearanceRule) -> Self

Appends a rule about how things look.

Source

pub fn filter(self, filter: ListFilter) -> Self

Appends a filter people pick from on its list.

Source

pub fn list_criteria(self, expression: impl Into<String>) -> Self

What every record its list shows has to meet.

Source

pub fn cloneable(self) -> Self

Its records can be cloned, with CloneModule.

Source

pub fn transient(self) -> Self

Its records are not kept by any storage: they live on a form or in a list given to them.

Source

pub fn checks_on_leave(self) -> Self

A form says what is wrong with a field as it is left, and not only on saving.

Source

pub fn list_editable(self) -> Self

People can change values right on its list, with the rules checked as they do.

Source

pub fn data_access(self, access: DataAccess) -> Self

How its list gets its records.

Source

pub fn form_actions(self, name: impl Into<String>) -> Self

A place on its form for the actions of ActionCategory::InForm with this name.

Source

pub fn focus_order( self, fields: impl IntoIterator<Item = impl Into<String>>, ) -> Self

The fields its form goes through first with the keyboard, in this order; the others follow in the order they were declared. The form shows them in the same order.

Source

pub fn form_columns(self, columns: u8) -> Self

How many columns its form’s fields go in.

Source

pub fn description(self, text: impl Into<String>) -> Self

What its list says it is there for, above the records.

Source

pub fn state_machine(self, machine: StateMachine) -> Self

Gives its records states, and only these ways between them. Its field becomes read-only on forms and starts in the machine’s first state, its actions come by themselves, and any other change is refused when it is kept. Declare the field first.

Source

pub fn state_appearance( self, field: &str, state: &str, rule: AppearanceRule, ) -> Self

An appearance that holds while its field is in this state.

Source

pub fn action(self, action: RecordAction) -> Self

An action that sets fields of the records selected. It comes by itself on its list and its form.

Source

pub fn reminder(self, reminder: Reminder) -> Self

Reminds people of its records.

Source

pub fn editor_setting( self, node: impl Into<String>, name: impl Into<String>, value: impl Into<String>, ) -> Self

Tells a list editor something about its list, as ChartSettings, Kind and Line. It goes in the model under the list’s view, so a person can change it like any other setting.

Source

pub fn variant(self, variant: ViewVariant) -> Self

Appends a way to see its list.

Source

pub fn field_named(&self, name: &str) -> Option<&FieldInfo>

A field by name.

Source

pub fn key_field(&self) -> Option<&FieldInfo>

The field that identifies a record.

Source

pub fn default_property(&self) -> Option<&FieldInfo>

The field that names a record: the first in lookups, or else the first with text.

Source

pub fn schema(&self) -> Schema

What expressions over this entity may refer to.

Source

pub fn check(&self) -> Result<(), ModelError>

Says what is wrong with how it was declared.

Source

pub fn new_object(&self) -> Object

A record of this entity with what a new one starts with.

Source

pub fn compute(&self, object: &mut Object, environment: &Environment)

Fills in the calculated fields, in the order declared, so one can read another.

Source

pub fn strip_calculated(&self, object: &mut Object)

The object as it is stored, with no calculated values.

Trait Implementations§

Source§

impl Clone for EntityInfo

Source§

fn clone(&self) -> EntityInfo

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for EntityInfo

Source§

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

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

impl PartialEq for EntityInfo

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for EntityInfo

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> Same for T

Source§

type Output = T

Should always be Self
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.