Skip to main content

FieldInfo

Struct FieldInfo 

Source
#[non_exhaustive]
pub struct FieldInfo {
Show 30 fields pub name: String, pub caption: String, pub kind: FieldKind, pub is_key: bool, pub read_only: bool, pub in_list: bool, pub in_detail: bool, pub in_lookup: bool, pub calculated: Option<String>, pub default_value: Value, pub editor: Option<String>, pub placeholder: Option<String>, pub wide: bool, pub autofocus: bool, pub hint: Option<String>, pub lookup_filter: Option<String>, pub none_caption: Option<String>, pub back_reference: Option<String>, pub non_cloneable: bool, pub aggregated: bool, pub most_bytes: Option<u64>, pub accepted: Vec<String>, pub group: Option<String>, pub display_format: Option<String>, pub edit_mask: Option<String>, pub predefined: Vec<String>, pub criteria_of: Option<String>, pub secret: bool, pub accessible_name: Option<String>, pub accessible_description: Option<String>,
}
Expand description

A field of an EntityInfo.

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 expressions and in the model.

§caption: String

What people see. Follows from the name unless given.

§kind: FieldKind

What it holds.

§is_key: bool

It identifies the record.

§read_only: bool

It can be seen but not changed.

§in_list: bool

It has a column in lists.

§in_detail: bool

It is on the form.

§in_lookup: bool

It has a column when picking a record of this entity.

§calculated: Option<String>

An expression that gives its value; nothing is stored.

§default_value: Value

What a new record starts with.

§editor: Option<String>

The control that edits it, by name, instead of the one for its kind.

§placeholder: Option<String>

What an empty editor shows.

§wide: bool

It takes the whole width of its group on a form.

§autofocus: bool

Takes the keyboard when its form opens.

§hint: Option<String>

What the form says under it.

§lookup_filter: Option<String>

For a reference: what its records have to meet, where ?field is the value of that field of the record being edited.

§none_caption: Option<String>

For a reference that can be left empty and is picked from a list: what empty is called.

§back_reference: Option<String>

For a collection: the field of the other entity that points back here, when it has more than one reference to this entity.

§non_cloneable: bool

It stays behind when a record is cloned.

§aggregated: bool

For a collection: its records belong to this one, and are cloned with it.

§most_bytes: Option<u64>

For a picture or a file: the largest taken, in bytes.

§accepted: Vec<String>

For a file: the extensions offered; none means any.

§group: Option<String>

The titled group it goes in on a form, away from the other fields.

§display_format: Option<String>

How its value shows when it is not being edited: {} is the value, {:.2} a number with these decimals, and {:dd/MM/yyyy HH:mm} a date.

§edit_mask: Option<String>

For text: the mask it is typed through, where 0 is a digit, A a letter and * anything.

§predefined: Vec<String>

For text: the values offered to pick from.

§criteria_of: Option<String>

For an expression: the entity whose fields it can be about, which gives it a filter builder.

§secret: bool

It never leaves storage through a secured space, for anyone, and no screen shows it.

§accessible_name: Option<String>

What screen readers call it, when the caption is not enough. The caption by default.

§accessible_description: Option<String>

What screen readers say after its name, such as what goes in it. The hint by default.

Implementations§

Source§

impl FieldInfo

Source

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

A field shown in lists and on the form.

Source

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

What people see.

Source

pub fn key(self) -> Self

Makes it the key: read-only, and out of lists and forms unless told otherwise.

Source

pub fn typed_key(self) -> Self

Makes it the key, typed by people, as a code is.

Source

pub fn default_property(self) -> Self

Makes it what names a record, for EntityInfo::default_property.

Source

pub fn read_only(self) -> Self

It can be seen but not changed.

Source

pub fn in_list(self, show: bool) -> Self

Whether it has a column in lists.

Source

pub fn in_detail(self, show: bool) -> Self

Whether it is on the form.

Source

pub fn in_lookup(self, show: bool) -> Self

Whether it has a column when picking a record.

Source

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

Gets its value from this expression, read-only and not stored.

Source

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

The control that edits it, by name: Segmented for options side by side, or one registered in an editor registry.

Source

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

What an empty editor shows.

Source

pub fn wide(self) -> Self

Takes the whole width of its group on a form.

Source

pub fn autofocus(self) -> Self

Takes the keyboard when its form opens.

Source

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

What the form says under it.

Source

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

What screen readers call it, instead of its caption: for a caption that only makes sense next to what is around it, such as Até for the end of a period.

Source

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

What screen readers say after its name, instead of its hint.

Source

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

For a reference: what its records have to meet, where ?field is the value of that field of the record being edited, as in [flow] = ?flow.

Source

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

For a reference that can be left empty and is picked from a list: what empty is called.

Source

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

For a collection: the field of the other entity that points back here.

Source

pub fn non_cloneable(self) -> Self

Stays behind when a record is cloned.

Source

pub fn aggregated(self) -> Self

For a collection: its records belong to this one, and are cloned with it.

Source

pub fn most_bytes(self, bytes: u64) -> Self

For a picture or a file: the largest taken, in bytes.

Source

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

For a file: the extensions offered, such as pdf.

Source

pub fn default_value(self, value: impl Into<Value>) -> Self

What a new record starts with.

Source

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

Goes in the group with this title on a form, as the parts of one thing do.

Source

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

How its value shows when it is not being edited: {} is the value, {:.2} a number with these decimals, and {:dd/MM/yyyy HH:mm} a date.

Source

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

For text: the mask it is typed through, where 0 is a digit, A a letter and * anything.

Source

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

For text: the values offered to pick from.

Source

pub fn secret(self) -> Self

Keeps it from everyone: a secured space never gives it out or takes it in, and no screen shows it, as with what is kept for a password.

Source

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

For an expression: the entity whose fields it can be about, which gives it a filter builder.

Trait Implementations§

Source§

impl Clone for FieldInfo

Source§

fn clone(&self) -> FieldInfo

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 FieldInfo

Source§

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

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

impl PartialEq for FieldInfo

Source§

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

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.