Trait Model
pub trait Model: Sized + 'static {
type Paths<R>: Clone;
const SHAPE: Shape = crate::Shape::Value;
const CHECKS: bool = false;
const OPS: bool = false;
const NULLABLE: bool = false;
const SCALAR: bool = false;
const TABLE: &'static ModelTable = _;
Show 23 methods
// Required methods
fn paths_at<R>(path: Path<R, Self>) -> Self::Paths<R>;
fn to_json(&self) -> Value;
fn from_json(value: &Value) -> Result<Self, ModelError>;
fn load(
doc: &AutoCommit,
value: &Value<'_>,
id: &ExId,
) -> Result<Self, ModelError>;
fn store(
&self,
doc: &mut AutoCommit,
slot: Slot<'_>,
) -> Result<(), ModelError>;
// Provided methods
fn edit(
doc: &mut AutoCommit,
slot: Slot<'_>,
path: &[Segment],
op: &EditOp,
cx: &mut ActionCx,
) -> Result<(), ModelError> { ... }
fn diff<R>(&self, after: &Self, path: &[Segment], out: &mut Vec<Edit<R>>) { ... }
fn nested_collections(&self) -> Vec<ItemCollection> { ... }
fn value_schema() -> Value { ... }
fn read_whole(&mut self, doc: &AutoCommit) -> Result<(), ModelError> { ... }
fn check(&self) -> Result<(), Refusal> { ... }
fn label(&self) -> Option<String> { ... }
fn op_coalesces(
path: &[Segment],
previous: &Value,
next: &Value,
) -> Option<bool> { ... }
fn op_continuable(path: &[Segment], op: &Value) -> Option<bool> { ... }
fn op_describe(path: &[Segment], op: &Value) -> Option<OpDescription> { ... }
fn op_lands(&self, path: &[Segment], op: &Value) -> Option<Place> { ... }
fn op_schemas(prefix: &str, out: &mut Vec<(String, Value)>) { ... }
fn get_at(&self, path: &[Segment]) -> Option<&(dyn Any + 'static)>
where Self: 'static { ... }
fn missing() -> Result<Self, ModelError> { ... }
fn stores_as(&self, before: &Self) -> bool { ... }
fn store_changed(
&self,
before: &Self,
doc: &mut AutoCommit,
slot: Slot<'_>,
dirty: &Delta,
) -> Result<(), ModelError> { ... }
fn refresh(
&mut self,
doc: &AutoCommit,
value: &Value<'_>,
id: &ExId,
delta: &Delta,
) -> Result<(), ModelError> { ... }
fn collect_text(&self, _out: &mut Vec<String>) { ... }
}Expand description
A typed value stored in a CRDT document. See the module docs.
Provided Associated Constants§
const SHAPE: Shape = crate::Shape::Value
const SHAPE: Shape = crate::Shape::Value
How the value is laid out in the document; see Shape.
Types written whole keep the default.
const CHECKS: bool = false
const CHECKS: bool = false
Whether this type or any value inside it has a #[model(check)]
invariant; Self::check has nothing to do otherwise.
const OPS: bool = false
const OPS: bool = false
Whether this type or a value inside it has a vocabulary of its own
(Operations, rich text’s): a record routes
those edits’ gestures, landing places and schemas only into such
fields, and never instantiates the routing for the others.
const NULLABLE: bool = false
const NULLABLE: bool = false
Whether null is a value of the type: an absent Option. A field
edit setting any other type to null is refused.
const TABLE: &'static ModelTable = _
const TABLE: &'static ModelTable = _
The type’s functions as data, which a record holding it reaches it
through ([crate::table]): by default its own functions, erased.
Required Associated Types§
Required Methods§
fn load(
doc: &AutoCommit,
value: &Value<'_>,
id: &ExId,
) -> Result<Self, ModelError>
fn load( doc: &AutoCommit, value: &Value<'_>, id: &ExId, ) -> Result<Self, ModelError>
Read from the value a parent found in its slot.
§Errors
Returns [ModelError] when the stored value has another shape.
fn store(&self, doc: &mut AutoCommit, slot: Slot<'_>) -> Result<(), ModelError>
fn store(&self, doc: &mut AutoCommit, slot: Slot<'_>) -> Result<(), ModelError>
Write self into slot, changing only what differs from what the slot
already holds.
§Errors
Returns the document’s write error.
Provided Methods§
fn edit(
doc: &mut AutoCommit,
slot: Slot<'_>,
path: &[Segment],
op: &EditOp,
cx: &mut ActionCx,
) -> Result<(), ModelError>
fn edit( doc: &mut AutoCommit, slot: Slot<'_>, path: &[Segment], op: &EditOp, cx: &mut ActionCx, ) -> Result<(), ModelError>
Apply the field edit op at path, below the value in slot,
touching only what it changes, then run the invariants of the values
it touched. The default edits a value only as a whole.
§Errors
Returns why the path or operation does not fit, or a refusal.
fn diff<R>(&self, after: &Self, path: &[Segment], out: &mut Vec<Edit<R>>)
fn diff<R>(&self, after: &Self, path: &[Segment], out: &mut Vec<Edit<R>>)
The field edits that turn self into after, at path below the
record: what a surface that edited a local copy submits. The default
sets the value whole when it changed; containers and records edit
only what differs, item by item and field by field.
fn nested_collections(&self) -> Vec<ItemCollection>
fn nested_collections(&self) -> Vec<ItemCollection>
The item collections inside this value, when it is an item of a
collection itself (a slide’s elements); #[derive(Model)] lists a
record’s, the default has none.
fn value_schema() -> Value
fn value_schema() -> Value
The JSON Schema of this value’s JSON form (Self::to_json), as
the published field edit describes what a path takes; the default
accepts any value.
fn read_whole(&mut self, doc: &AutoCommit) -> Result<(), ModelError>
fn read_whole(&mut self, doc: &AutoCommit) -> Result<(), ModelError>
Read everything this value holds, for a field marked
#[model(whole)]: a value read lazily (rich text reads its
paragraphs as views ask for them) reads all of it, so every reader of
the record — a verb, search, read_content — sees all of it. The
default has nothing more to read.
§Errors
Returns [ModelError] when the document no longer holds the value.
fn check(&self) -> Result<(), Refusal>
fn check(&self) -> Result<(), Refusal>
Run every #[model(check)] invariant of this value and the values
inside it.
§Errors
Returns the first refusal.
fn label(&self) -> Option<String>
fn label(&self) -> Option<String>
What names this value for people (#[model(label)]): history, search,
agents and item resources use it.
fn op_coalesces(
path: &[Segment],
previous: &Value,
next: &Value,
) -> Option<bool>
fn op_coalesces( path: &[Segment], previous: &Value, next: &Value, ) -> Option<bool>
Whether two edits in the own vocabulary of the value at path below
this type are one gesture (Operations); None
when nothing there has one.
fn op_continuable(path: &[Segment], op: &Value) -> Option<bool>
fn op_continuable(path: &[Segment], op: &Value) -> Option<bool>
Whether a gesture may go on after the edit op at path.
fn op_describe(path: &[Segment], op: &Value) -> Option<OpDescription>
fn op_describe(path: &[Segment], op: &Value) -> Option<OpDescription>
What the edit op at path below this type did, in the history
entry’s terms (Operations::describe).
fn op_lands(&self, path: &[Segment], op: &Value) -> Option<Place>
fn op_lands(&self, path: &[Segment], op: &Value) -> Option<Place>
Where the actor of the edit op at path below this value is after
it applied.
fn op_schemas(prefix: &str, out: &mut Vec<(String, Value)>)
fn op_schemas(prefix: &str, out: &mut Vec<(String, Value)>)
The schemas of the own vocabularies of the values below this type,
by path pattern from prefix (* for every item).
fn get_at(&self, path: &[Segment]) -> Option<&(dyn Any + 'static)>where
Self: 'static,
fn get_at(&self, path: &[Segment]) -> Option<&(dyn Any + 'static)>where
Self: 'static,
The value at path below this one, if it is there. A value with
nothing inside it is found only at the empty path.
fn missing() -> Result<Self, ModelError>
fn missing() -> Result<Self, ModelError>
The value of an absent slot. Types with a natural empty value return it, so a field added to a schema reads older documents without migration.
§Errors
Returns [ModelError::Missing] for types without an empty value.
fn stores_as(&self, before: &Self) -> bool
fn stores_as(&self, before: &Self) -> bool
Whether writing self over a slot that holds before, as a
store left it, would change nothing: an in-memory
comparison, so an action that changed one item of a long collection
does not visit the others. Must only answer true when store would
write no operation; the default answers false (unknown).
fn store_changed(
&self,
before: &Self,
doc: &mut AutoCommit,
slot: Slot<'_>,
dirty: &Delta,
) -> Result<(), ModelError>
fn store_changed( &self, before: &Self, doc: &mut AutoCommit, slot: Slot<'_>, dirty: &Delta, ) -> Result<(), ModelError>
Write self into slot, which holds before: exactly the operations
store would write, found by comparing with before
where store would read the document.
before is what load reads from the slot now, and the
slot is as a store left it except where dirty (changes written by
someone else since) says otherwise: a slot dirty touched is written
as store would. The default is store. An action’s write is
replayed on every replica, so an override that writes anything else
forks the document.
§Errors
Returns the document’s write error.
fn refresh(
&mut self,
doc: &AutoCommit,
value: &Value<'_>,
id: &ExId,
delta: &Delta,
) -> Result<(), ModelError>
fn refresh( &mut self, doc: &AutoCommit, value: &Value<'_>, id: &ExId, delta: &Delta, ) -> Result<(), ModelError>
Bring a value read earlier up to date after the changes in delta,
re-reading only what they touched. value and id are what the
parent’s slot holds now — the same object as when self was read, or
the parent would have read it anew. The default reads the value again,
which is right for scalars and short values.
§Errors
Returns [ModelError] when the stored value has another shape.
fn collect_text(&self, _out: &mut Vec<String>)
fn collect_text(&self, _out: &mut Vec<String>)
Append the human-readable text this value carries, for search indexing.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
§impl Model for bool
impl Model for bool
const SCALAR: bool = true
const TABLE: &'static ModelTable
type Paths<R> = Path<R, bool>
fn value_schema() -> Value
fn paths_at<R>(path: Path<R, bool>) -> Path<R, bool>
fn to_json(&self) -> Value
fn from_json(value: &Value) -> Result<bool, ModelError>
fn load(_: &AutoCommit, value: &Value<'_>, _: &ExId) -> Result<bool, ModelError>
fn missing() -> Result<bool, ModelError>
fn store(&self, doc: &mut AutoCommit, slot: Slot<'_>) -> Result<(), ModelError>
fn stores_as(&self, before: &bool) -> bool
§impl Model for f32
impl Model for f32
const SCALAR: bool = true
const TABLE: &'static ModelTable
type Paths<R> = Path<R, f32>
fn value_schema() -> Value
fn paths_at<R>(path: Path<R, f32>) -> Path<R, f32>
fn to_json(&self) -> Value
fn from_json(value: &Value) -> Result<f32, ModelError>
fn load( doc: &AutoCommit, value: &Value<'_>, id: &ExId, ) -> Result<f32, ModelError>
fn missing() -> Result<f32, ModelError>
fn store(&self, doc: &mut AutoCommit, slot: Slot<'_>) -> Result<(), ModelError>
fn stores_as(&self, before: &f32) -> bool
§impl Model for f64
impl Model for f64
const SCALAR: bool = true
const TABLE: &'static ModelTable
type Paths<R> = Path<R, f64>
fn value_schema() -> Value
fn paths_at<R>(path: Path<R, f64>) -> Path<R, f64>
fn to_json(&self) -> Value
fn from_json(value: &Value) -> Result<f64, ModelError>
fn load(_: &AutoCommit, value: &Value<'_>, _: &ExId) -> Result<f64, ModelError>
fn missing() -> Result<f64, ModelError>
fn store(&self, doc: &mut AutoCommit, slot: Slot<'_>) -> Result<(), ModelError>
fn stores_as(&self, before: &f64) -> bool
§impl Model for i8
impl Model for i8
const SCALAR: bool = true
const TABLE: &'static ModelTable
type Paths<R> = Path<R, i8>
fn value_schema() -> Value
fn paths_at<R>(path: Path<R, i8>) -> Path<R, i8>
fn to_json(&self) -> Value
fn from_json(value: &Value) -> Result<i8, ModelError>
fn load(_: &AutoCommit, value: &Value<'_>, _: &ExId) -> Result<i8, ModelError>
fn missing() -> Result<i8, ModelError>
fn store(&self, doc: &mut AutoCommit, slot: Slot<'_>) -> Result<(), ModelError>
fn stores_as(&self, before: &i8) -> bool
§impl Model for i16
impl Model for i16
const SCALAR: bool = true
const TABLE: &'static ModelTable
type Paths<R> = Path<R, i16>
fn value_schema() -> Value
fn paths_at<R>(path: Path<R, i16>) -> Path<R, i16>
fn to_json(&self) -> Value
fn from_json(value: &Value) -> Result<i16, ModelError>
fn load(_: &AutoCommit, value: &Value<'_>, _: &ExId) -> Result<i16, ModelError>
fn missing() -> Result<i16, ModelError>
fn store(&self, doc: &mut AutoCommit, slot: Slot<'_>) -> Result<(), ModelError>
fn stores_as(&self, before: &i16) -> bool
§impl Model for i32
impl Model for i32
const SCALAR: bool = true
const TABLE: &'static ModelTable
type Paths<R> = Path<R, i32>
fn value_schema() -> Value
fn paths_at<R>(path: Path<R, i32>) -> Path<R, i32>
fn to_json(&self) -> Value
fn from_json(value: &Value) -> Result<i32, ModelError>
fn load(_: &AutoCommit, value: &Value<'_>, _: &ExId) -> Result<i32, ModelError>
fn missing() -> Result<i32, ModelError>
fn store(&self, doc: &mut AutoCommit, slot: Slot<'_>) -> Result<(), ModelError>
fn stores_as(&self, before: &i32) -> bool
§impl Model for i64
impl Model for i64
const SCALAR: bool = true
const TABLE: &'static ModelTable
type Paths<R> = Path<R, i64>
fn value_schema() -> Value
fn paths_at<R>(path: Path<R, i64>) -> Path<R, i64>
fn to_json(&self) -> Value
fn from_json(value: &Value) -> Result<i64, ModelError>
fn load(_: &AutoCommit, value: &Value<'_>, _: &ExId) -> Result<i64, ModelError>
fn missing() -> Result<i64, ModelError>
fn store(&self, doc: &mut AutoCommit, slot: Slot<'_>) -> Result<(), ModelError>
fn stores_as(&self, before: &i64) -> bool
§impl Model for isize
impl Model for isize
const SCALAR: bool = true
const TABLE: &'static ModelTable
type Paths<R> = Path<R, isize>
fn value_schema() -> Value
fn paths_at<R>(path: Path<R, isize>) -> Path<R, isize>
fn to_json(&self) -> Value
fn from_json(value: &Value) -> Result<isize, ModelError>
fn load( _: &AutoCommit, value: &Value<'_>, _: &ExId, ) -> Result<isize, ModelError>
fn missing() -> Result<isize, ModelError>
fn store(&self, doc: &mut AutoCommit, slot: Slot<'_>) -> Result<(), ModelError>
fn stores_as(&self, before: &isize) -> bool
§impl Model for u8
impl Model for u8
const SCALAR: bool = true
const TABLE: &'static ModelTable
type Paths<R> = Path<R, u8>
fn value_schema() -> Value
fn paths_at<R>(path: Path<R, u8>) -> Path<R, u8>
fn to_json(&self) -> Value
fn from_json(value: &Value) -> Result<u8, ModelError>
fn load(_: &AutoCommit, value: &Value<'_>, _: &ExId) -> Result<u8, ModelError>
fn missing() -> Result<u8, ModelError>
fn store(&self, doc: &mut AutoCommit, slot: Slot<'_>) -> Result<(), ModelError>
fn stores_as(&self, before: &u8) -> bool
§impl Model for u16
impl Model for u16
const SCALAR: bool = true
const TABLE: &'static ModelTable
type Paths<R> = Path<R, u16>
fn value_schema() -> Value
fn paths_at<R>(path: Path<R, u16>) -> Path<R, u16>
fn to_json(&self) -> Value
fn from_json(value: &Value) -> Result<u16, ModelError>
fn load(_: &AutoCommit, value: &Value<'_>, _: &ExId) -> Result<u16, ModelError>
fn missing() -> Result<u16, ModelError>
fn store(&self, doc: &mut AutoCommit, slot: Slot<'_>) -> Result<(), ModelError>
fn stores_as(&self, before: &u16) -> bool
§impl Model for u32
impl Model for u32
const SCALAR: bool = true
const TABLE: &'static ModelTable
type Paths<R> = Path<R, u32>
fn value_schema() -> Value
fn paths_at<R>(path: Path<R, u32>) -> Path<R, u32>
fn to_json(&self) -> Value
fn from_json(value: &Value) -> Result<u32, ModelError>
fn load(_: &AutoCommit, value: &Value<'_>, _: &ExId) -> Result<u32, ModelError>
fn missing() -> Result<u32, ModelError>
fn store(&self, doc: &mut AutoCommit, slot: Slot<'_>) -> Result<(), ModelError>
fn stores_as(&self, before: &u32) -> bool
§impl Model for u64
impl Model for u64
const SCALAR: bool = true
const TABLE: &'static ModelTable
type Paths<R> = Path<R, u64>
fn value_schema() -> Value
fn paths_at<R>(path: Path<R, u64>) -> Path<R, u64>
fn to_json(&self) -> Value
fn from_json(value: &Value) -> Result<u64, ModelError>
fn load(_: &AutoCommit, value: &Value<'_>, _: &ExId) -> Result<u64, ModelError>
fn missing() -> Result<u64, ModelError>
fn store(&self, doc: &mut AutoCommit, slot: Slot<'_>) -> Result<(), ModelError>
fn stores_as(&self, before: &u64) -> bool
§impl Model for ()
Nothing: a value that stores nothing, for the members of a container that
only orders ids (a [Grid]’s rows and columns).
impl Model for ()
Nothing: a value that stores nothing, for the members of a container that
only orders ids (a [Grid]’s rows and columns).
§fn store(&self, _: &mut AutoCommit, _: Slot<'_>) -> Result<(), ModelError>
fn store(&self, _: &mut AutoCommit, _: Slot<'_>) -> Result<(), ModelError>
Nothing is written: an absent slot reads as () already.
const TABLE: &'static ModelTable
type Paths<R> = Path<R, ()>
fn paths_at<R>(path: Path<R, ()>) -> Path<R, ()>
fn to_json(&self) -> Value
fn from_json(_: &Value) -> Result<(), ModelError>
fn load(_: &AutoCommit, _: &Value<'_>, _: &ExId) -> Result<(), ModelError>
fn missing() -> Result<(), ModelError>
§impl Model for usize
impl Model for usize
const SCALAR: bool = true
const TABLE: &'static ModelTable
type Paths<R> = Path<R, usize>
fn value_schema() -> Value
fn paths_at<R>(path: Path<R, usize>) -> Path<R, usize>
fn to_json(&self) -> Value
fn from_json(value: &Value) -> Result<usize, ModelError>
fn load( _: &AutoCommit, value: &Value<'_>, _: &ExId, ) -> Result<usize, ModelError>
fn missing() -> Result<usize, ModelError>
fn store(&self, doc: &mut AutoCommit, slot: Slot<'_>) -> Result<(), ModelError>
fn stores_as(&self, before: &usize) -> bool
§impl Model for String
impl Model for String
§fn store_changed(
&self,
before: &String,
doc: &mut AutoCommit,
slot: Slot<'_>,
_dirty: &Delta,
) -> Result<(), ModelError>
fn store_changed( &self, before: &String, doc: &mut AutoCommit, slot: Slot<'_>, _dirty: &Delta, ) -> Result<(), ModelError>
The one splice store makes, found from before
instead of reading the whole text back.
const TABLE: &'static ModelTable
type Paths<R> = Path<R, String>
fn value_schema() -> Value
fn paths_at<R>(path: Path<R, String>) -> Path<R, String>
fn to_json(&self) -> Value
fn from_json(value: &Value) -> Result<String, ModelError>
fn edit( doc: &mut AutoCommit, slot: Slot<'_>, path: &[Segment], op: &EditOp, _cx: &mut ActionCx, ) -> Result<(), ModelError>
fn load( doc: &AutoCommit, value: &Value<'_>, id: &ExId, ) -> Result<String, ModelError>
fn missing() -> Result<String, ModelError>
fn store(&self, doc: &mut AutoCommit, slot: Slot<'_>) -> Result<(), ModelError>
fn stores_as(&self, before: &String) -> bool
fn collect_text(&self, out: &mut Vec<String>)
§impl<T> Model for Option<T>where
T: Model,
impl<T> Model for Option<T>where
T: Model,
const SHAPE: Shape = T::SHAPE
const CHECKS: bool = T::CHECKS
const OPS: bool = T::OPS
const NULLABLE: bool = true
const TABLE: &'static ModelTable
type Paths<R> = Path<R, Option<T>>
fn value_schema() -> Value
fn paths_at<R>(path: Path<R, Option<T>>) -> Path<R, Option<T>>
fn op_coalesces( path: &[Segment], previous: &Value, next: &Value, ) -> Option<bool>
fn op_continuable(path: &[Segment], op: &Value) -> Option<bool>
fn op_describe(path: &[Segment], op: &Value) -> Option<OpDescription>
fn op_lands(&self, path: &[Segment], op: &Value) -> Option<Place>
fn op_schemas(prefix: &str, out: &mut Vec<(String, Value)>)
fn to_json(&self) -> Value
fn from_json(value: &Value) -> Result<Option<T>, ModelError>
fn edit( doc: &mut AutoCommit, slot: Slot<'_>, path: &[Segment], op: &EditOp, cx: &mut ActionCx, ) -> Result<(), ModelError>
fn check(&self) -> Result<(), Refusal>
fn get_at(&self, path: &[Segment]) -> Option<&(dyn Any + 'static)>
fn diff<R>(&self, after: &Option<T>, path: &[Segment], out: &mut Vec<Edit<R>>)
fn load( doc: &AutoCommit, value: &Value<'_>, id: &ExId, ) -> Result<Option<T>, ModelError>
fn store(&self, doc: &mut AutoCommit, slot: Slot<'_>) -> Result<(), ModelError>
fn stores_as(&self, before: &Option<T>) -> bool
fn store_changed( &self, before: &Option<T>, doc: &mut AutoCommit, slot: Slot<'_>, dirty: &Delta, ) -> Result<(), ModelError>
fn refresh( &mut self, doc: &AutoCommit, value: &Value<'_>, id: &ExId, delta: &Delta, ) -> Result<(), ModelError>
fn collect_text(&self, out: &mut Vec<String>)
fn label(&self) -> Option<String>
fn missing() -> Result<Option<T>, ModelError>
§impl<T> Model for Box<T>where
T: Model,
impl<T> Model for Box<T>where
T: Model,
const SCALAR: bool = T::SCALAR
const SHAPE: Shape = T::SHAPE
const CHECKS: bool = T::CHECKS
const OPS: bool = T::OPS
const NULLABLE: bool = T::NULLABLE
type Paths<R> = <T as Model>::Paths<R>
fn value_schema() -> Value
fn op_coalesces( path: &[Segment], previous: &Value, next: &Value, ) -> Option<bool>
fn op_continuable(path: &[Segment], op: &Value) -> Option<bool>
fn op_describe(path: &[Segment], op: &Value) -> Option<OpDescription>
fn op_lands(&self, path: &[Segment], op: &Value) -> Option<Place>
fn op_schemas(prefix: &str, out: &mut Vec<(String, Value)>)
fn paths_at<R>(path: Path<R, Box<T>>) -> <T as Model>::Paths<R>
fn to_json(&self) -> Value
fn from_json(value: &Value) -> Result<Box<T>, ModelError>
fn edit( doc: &mut AutoCommit, slot: Slot<'_>, path: &[Segment], op: &EditOp, cx: &mut ActionCx, ) -> Result<(), ModelError>
fn check(&self) -> Result<(), Refusal>
fn diff<R>(&self, after: &Box<T>, path: &[Segment], out: &mut Vec<Edit<R>>)
fn label(&self) -> Option<String>
fn get_at(&self, path: &[Segment]) -> Option<&(dyn Any + 'static)>where
Box<T>: 'static,
fn load( doc: &AutoCommit, value: &Value<'_>, id: &ExId, ) -> Result<Box<T>, ModelError>
fn missing() -> Result<Box<T>, ModelError>
fn store(&self, doc: &mut AutoCommit, slot: Slot<'_>) -> Result<(), ModelError>
fn stores_as(&self, before: &Box<T>) -> bool
fn store_changed( &self, before: &Box<T>, doc: &mut AutoCommit, slot: Slot<'_>, dirty: &Delta, ) -> Result<(), ModelError>
fn refresh( &mut self, doc: &AutoCommit, value: &Value<'_>, id: &ExId, delta: &Delta, ) -> Result<(), ModelError>
fn collect_text(&self, out: &mut Vec<String>)
§impl<T> Model for BTreeMap<String, T>where
T: Model,
impl<T> Model for BTreeMap<String, T>where
T: Model,
const SHAPE: Shape
const CHECKS: bool = T::CHECKS
const OPS: bool = T::OPS
const TABLE: &'static ModelTable
type Paths<R> = Path<R, BTreeMap<String, T>>
fn value_schema() -> Value
fn paths_at<R>( path: Path<R, BTreeMap<String, T>>, ) -> Path<R, BTreeMap<String, T>>
fn op_coalesces( path: &[Segment], previous: &Value, next: &Value, ) -> Option<bool>
fn op_continuable(path: &[Segment], op: &Value) -> Option<bool>
fn op_describe(path: &[Segment], op: &Value) -> Option<OpDescription>
fn op_lands(&self, path: &[Segment], op: &Value) -> Option<Place>
fn op_schemas(prefix: &str, out: &mut Vec<(String, Value)>)
fn to_json(&self) -> Value
fn from_json(value: &Value) -> Result<BTreeMap<String, T>, ModelError>
fn edit( doc: &mut AutoCommit, slot: Slot<'_>, path: &[Segment], op: &EditOp, cx: &mut ActionCx, ) -> Result<(), ModelError>
fn check(&self) -> Result<(), Refusal>
fn get_at(&self, path: &[Segment]) -> Option<&(dyn Any + 'static)>
fn diff<R>( &self, after: &BTreeMap<String, T>, path: &[Segment], out: &mut Vec<Edit<R>>, )
fn load( doc: &AutoCommit, value: &Value<'_>, id: &ExId, ) -> Result<BTreeMap<String, T>, ModelError>
fn store(&self, doc: &mut AutoCommit, slot: Slot<'_>) -> Result<(), ModelError>
fn stores_as(&self, before: &BTreeMap<String, T>) -> bool
fn store_changed( &self, before: &BTreeMap<String, T>, doc: &mut AutoCommit, slot: Slot<'_>, dirty: &Delta, ) -> Result<(), ModelError>
fn refresh( &mut self, doc: &AutoCommit, value: &Value<'_>, id: &ExId, delta: &Delta, ) -> Result<(), ModelError>
fn collect_text(&self, out: &mut Vec<String>)
fn missing() -> Result<BTreeMap<String, T>, ModelError>
§impl<T> Model for Vec<T>where
T: Model,
impl<T> Model for Vec<T>where
T: Model,
const CHECKS: bool = T::CHECKS
const OPS: bool = T::OPS
const TABLE: &'static ModelTable
type Paths<R> = Path<R, Vec<T>>
fn value_schema() -> Value
fn paths_at<R>(path: Path<R, Vec<T>>) -> Path<R, Vec<T>>
fn op_coalesces( path: &[Segment], previous: &Value, next: &Value, ) -> Option<bool>
fn op_continuable(path: &[Segment], op: &Value) -> Option<bool>
fn op_describe(path: &[Segment], op: &Value) -> Option<OpDescription>
fn op_lands(&self, path: &[Segment], op: &Value) -> Option<Place>
fn op_schemas(prefix: &str, out: &mut Vec<(String, Value)>)
fn to_json(&self) -> Value
fn from_json(value: &Value) -> Result<Vec<T>, ModelError>
fn edit( doc: &mut AutoCommit, slot: Slot<'_>, path: &[Segment], op: &EditOp, cx: &mut ActionCx, ) -> Result<(), ModelError>
fn check(&self) -> Result<(), Refusal>
fn get_at(&self, path: &[Segment]) -> Option<&(dyn Any + 'static)>
fn diff<R>(&self, after: &Vec<T>, path: &[Segment], out: &mut Vec<Edit<R>>)
fn load( doc: &AutoCommit, value: &Value<'_>, id: &ExId, ) -> Result<Vec<T>, ModelError>
fn store(&self, doc: &mut AutoCommit, slot: Slot<'_>) -> Result<(), ModelError>
fn stores_as(&self, before: &Vec<T>) -> bool
fn store_changed( &self, before: &Vec<T>, doc: &mut AutoCommit, slot: Slot<'_>, dirty: &Delta, ) -> Result<(), ModelError>
fn refresh( &mut self, doc: &AutoCommit, value: &Value<'_>, id: &ExId, delta: &Delta, ) -> Result<(), ModelError>
fn collect_text(&self, out: &mut Vec<String>)
fn missing() -> Result<Vec<T>, ModelError>
§impl<T, const N: usize> Model for [T; N]where
T: Model,
impl<T, const N: usize> Model for [T; N]where
T: Model,
const CHECKS: bool = T::CHECKS
const OPS: bool = T::OPS
type Paths<R> = Path<R, [T; N]>
fn value_schema() -> Value
fn paths_at<R>(path: Path<R, [T; N]>) -> Path<R, [T; N]>
fn to_json(&self) -> Value
fn from_json(value: &Value) -> Result<[T; N], ModelError>
fn load( doc: &AutoCommit, value: &Value<'_>, id: &ExId, ) -> Result<[T; N], ModelError>
fn missing() -> Result<[T; N], ModelError>
fn store(&self, doc: &mut AutoCommit, slot: Slot<'_>) -> Result<(), ModelError>
Implementors§
Source§impl Model for FeedbackDraft
impl Model for FeedbackDraft
§impl Model for TextAssistancePrefs
impl Model for TextAssistancePrefs
§impl Model for DistributionDefaults
impl Model for DistributionDefaults
§impl<O> Model for Settled<O>
A settlement stores as one JSON value: it is written once, by the owning
device.
impl<O> Model for Settled<O>
A settlement stores as one JSON value: it is written once, by the owning device.