pub struct FieldShape {Show 18 fields
pub key: &'static str,
pub owner: &'static str,
pub name: &'static str,
pub ty: &'static str,
pub title: &'static str,
pub shape: Shape,
pub unit: bool,
pub readonly: bool,
pub atom: bool,
pub label: bool,
pub label_part: u8,
pub quiet_remove: bool,
pub trust: Trust,
pub schema: fn() -> Value,
pub field_type: fn(&mut TypeSet) -> FieldType,
pub text: StoredText,
pub absent: fn() -> Option<Value>,
pub resource: Option<NestedResource>,
}Expand description
One named field of a Shape::Record.
Fields§
§key: &'static strThe key the field is stored under (after #[model(rename)]).
owner: &'static strThe record type the field belongs to, in kebab case (snippet): with
the key it names the field in history messages
(<app>-<owner>-<key>).
name: &'static strThe field’s Rust name.
ty: &'static strThe field’s Rust type, as written.
title: &'static strWhat the field is, for people: its doc comment’s first line, else its name in words. History falls back to it (“Changed Folder”).
shape: Shape§unit: bool#[model(unit)]: the field is its own storage unit (for a
collection, each item is one), so a server can tell who may write it
without reading content.
readonly: bool#[model(readonly)]: published for reading, changed only by verbs.
atom: bool#[model(atom)]: stored whole, last writer wins, so an edit sets
all of it and never splices characters into it.
label: bool#[model(label)]: the field names the record.
label_part: u8Where the field stands among those whose texts, joined by spaces,
name the record before its label field does
(#[model(label = "first last")] on the type): 1 for the first, 0
when it is not one of them.
quiet_remove: bool#[model(remove = "quiet")] on a collection: removing an item by
field edit asks no confirmation. Otherwise it is destructive, as a
delete verb is, so the generic edit is never a quieter way around it.
trust: Trust#[model(trust = "..")]: who may change the field without being
asked first.
schema: fn() -> ValueThe JSON Schema of the field’s value (Model::value_schema).
field_type: fn(&mut TypeSet) -> FieldTypeThe field’s type in the language-neutral vocabulary
(Model::field_type).
text: StoredTextThe first line of the field’s text as stored (stored_text): what
a label made of it reads, rich text included.
absent: fn() -> Option<Value>What the field reads as while its key is absent, for a scalar field
(absent_scalar): history names it as the value an edit replaced.
resource: Option<NestedResource>#[model(resource)]: the field holds a resource of its own type,
published beneath the resource of the record holding it
(NestedResource).
Trait Implementations§
Source§impl Clone for FieldShape
impl Clone for FieldShape
impl Copy for FieldShape
Source§impl Debug for FieldShape
impl Debug for FieldShape
impl Eq for FieldShape
Source§impl PartialEq for FieldShape
Two fields are the same field when everything but their value schema’s
function (which compares by address) is.
impl PartialEq for FieldShape
Two fields are the same field when everything but their value schema’s function (which compares by address) is.
Auto Trait Implementations§
impl Forget for FieldShape
impl Freeze for FieldShape
impl Move for FieldShape
impl RefUnwindSafe for FieldShape
impl Send for FieldShape
impl Sync for FieldShape
impl Unpin for FieldShape
impl UnsafeUnpin for FieldShape
impl UnwindSafe for FieldShape
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more