pub enum Shape {
Value,
Record(&'static [FieldShape]),
Collection(&'static Shape),
Keyed(&'static Shape),
Map(&'static Shape),
}Expand description
How one value is laid out in the document.
Variants§
Value
Written and restored whole: a scalar, a text, a list, a JSON value.
Record(&'static [FieldShape])
A map of named fields, each with its own shape.
Collection(&'static Shape)
A keyed, ordered Collection of items of one
shape. Each item is stored under its id as an entry map holding its
order key (ENTRY_ORDER_KEY) and its value (ENTRY_VALUE_KEY).
Keyed(&'static Shape)
Items of one shape stored under the ids they carry
(Keyed): each item’s value directly under its id.
Map(&'static Shape)
A map (BTreeMap<String, T>) of values of one shape, each under its
key: an edit inside an entry is about that entry, named by its key or
its value’s label.
Implementations§
Source§impl Shape
impl Shape
Sourcepub const fn fields(&self) -> &'static [FieldShape]
pub const fn fields(&self) -> &'static [FieldShape]
The fields of a record shape; none for any other.
Sourcepub fn unit_of(&self, path: &[Segment]) -> Vec<Segment>
pub fn unit_of(&self, path: &[Segment]) -> Vec<Segment>
The storage unit a change at path (from this shape’s root) writes:
the longest prefix of the path that ends at a #[model(unit)] field
or an item of one. The record itself, the empty path, is a unit too.
Sourcepub fn quiet_removals(&self) -> Vec<String>
pub fn quiet_removals(&self) -> Vec<String>
The collections below this shape whose removals ask nothing
(#[model(remove = "quiet")]), by their dotted paths (* for an
item), as tilo_action_policy::edits::dotted spells them.
Sourcepub fn guarded_fields(&self) -> Vec<(String, Trust)>
pub fn guarded_fields(&self) -> Vec<(String, Trust)>
The fields below this shape that are not Trust::Ordinary, by
their dotted paths (* for an item), as
tilo_action_policy::edits::dotted spells them.
Sourcepub fn trust_at(&self, path: &[Segment]) -> Trust
pub fn trust_at(&self, path: &[Segment]) -> Trust
The trust of the field at path: the strictest of the fields it is
at or below.
Sourcepub fn readonly_at(&self, path: &[Segment]) -> bool
pub fn readonly_at(&self, path: &[Segment]) -> bool
Whether the field at path is #[model(readonly)].
Sourcepub fn changed_readonly<'a>(
&self,
before: Option<&'a Value>,
after: Option<&'a Value>,
) -> Option<String>
pub fn changed_readonly<'a>( &self, before: Option<&'a Value>, after: Option<&'a Value>, ) -> Option<String>
The first field this lays out that is read only and after changes from before, by its
path (themes.mine.dark): a field only the record’s own verbs change, never a field edit.
before and after are the record’s JSON form (Model::to_json).
Trait Implementations§
impl Copy for Shape
impl Eq for Shape
impl StructuralPartialEq for Shape
Auto Trait Implementations§
impl Forget for Shape
impl Freeze for Shape
impl Move for Shape
impl RefUnwindSafe for Shape
impl Send for Shape
impl Sync for Shape
impl Unpin for Shape
impl UnsafeUnpin for Shape
impl UnwindSafe for Shape
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