Skip to main content

Model

Trait Model 

Source
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 25 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: &Doc, value: &Value<'_>, id: &ObjId, ) -> Result<Self, ModelError>; fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>; // Provided methods fn edit( doc: &mut Doc, 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 field_type(types: &mut TypeSet) -> FieldType { ... } fn read_whole(&mut self, doc: &Doc) -> 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> where Self: 'static { ... } fn missing() -> Result<Self, ModelError> { ... } fn fresh(&self, encoding: TextEncoding) -> Fresh { ... } fn stores_as(&self, before: &Self) -> bool { ... } fn store_changed( &self, before: &Self, doc: &mut Doc, slot: Slot<'_>, dirty: &Delta, ) -> Result<(), ModelError> { ... } fn refresh( &mut self, doc: &Doc, value: &Value<'_>, id: &ObjId, 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§

Source

const SHAPE: Shape = crate::Shape::Value

How the value is laid out in the document; see Shape. Types written whole keep the default.

Source

const CHECKS: bool = false

Whether this type or any value inside it has a #[model(check)] invariant; Self::check has nothing to do otherwise.

Source

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.

Source

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.

Source

const SCALAR: bool = false

Whether store writes one scalar, with nothing inside it that a concurrent writer could add to. A record made just now leaves out such a field holding its missing value: an absent key reads as it. An object (text, a map, a list) is always made with its record, so two writers fill the same one.

Source

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§

Source

type Paths<R>: Clone

The typed paths into a value of this type, rooted in the record R: a struct of field paths for a record, the Path itself for a value edited whole or through its own operations.

Required Methods§

Source

fn paths_at<R>(path: Path<R, Self>) -> Self::Paths<R>

The paths of the value at path.

Source

fn to_json(&self) -> Value

The value as JSON: what EditOp::Set carries and history shows.

Source

fn from_json(value: &Value) -> Result<Self, ModelError>

A value from its Self::to_json form.

§Errors

Returns ModelError when value has another shape.

Source

fn load(doc: &Doc, value: &Value<'_>, id: &ObjId) -> Result<Self, ModelError>

Read from the value a parent found in its slot.

§Errors

Returns ModelError when the stored value has another shape.

Source

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Write self into slot, changing only what differs from what the slot already holds.

Provided Methods§

Source

fn edit( doc: &mut Doc, 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.

Source

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. A value that would store as it is (Self::stores_as) is compared in memory, without turning either side into JSON.

Source

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.

Source

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.

Source

fn field_type(types: &mut TypeSet) -> FieldType

This value’s type in the language-neutral vocabulary a surface publishes (FieldType), declaring the records and enums it names in types. The default describes no type: any value.

Source

fn read_whole(&mut self, doc: &Doc) -> 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.

Source

fn check(&self) -> Result<(), Refusal>

Run every #[model(check)] invariant of this value and the values inside it.

Source

fn label(&self) -> Option<String>

What names this value for people (#[model(label)]): history, search, agents and item resources use it.

Source

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.

Source

fn op_continuable(path: &[Segment], op: &Value) -> Option<bool>

Whether a gesture may go on after the edit op at path.

Source

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).

Source

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.

Source

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).

Source

fn get_at(&self, path: &[Segment]) -> Option<&dyn Any>
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.

Source

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.

Source

fn fresh(&self, encoding: TextEncoding) -> Fresh

What store writes under a key of a map made just now, for the map to be made with it at once; encoding is the document’s text encoding. The default stores it once the map is made.

Source

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).

Source

fn store_changed( &self, before: &Self, doc: &mut Doc, 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.

Source

fn refresh( &mut self, doc: &Doc, value: &Value<'_>, id: &ObjId, 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.

Source

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".

Implementations on Foreign Types§

Source§

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).

Source§

fn store(&self, _: &mut Doc, _: Slot<'_>) -> Result<(), ModelError>

Nothing is written: an absent slot reads as () already.

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, ()>

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(_: &Value) -> Result<Self, ModelError>

Source§

fn load(_: &Doc, _: &Value<'_>, _: &ObjId) -> Result<Self, ModelError>

Source§

fn missing() -> Result<Self, ModelError>

Source§

impl Model for ActionParam

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, ActionParam>

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn op_coalesces( path: &[Segment], previous: &Value, next: &Value, ) -> Option<bool>

Source§

fn op_continuable(path: &[Segment], op: &Value) -> Option<bool>

Source§

fn op_describe(path: &[Segment], op: &Value) -> Option<OpDescription>

Source§

fn op_lands(&self, path: &[Segment], op: &Value) -> Option<Place>

Source§

fn op_schemas(prefix: &str, out: &mut Vec<(String, Value)>)

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn edit( doc: &mut Doc, slot: Slot<'_>, path: &[Segment], op: &EditOp, cx: &mut ActionCx, ) -> Result<(), ModelError>

Source§

fn check(&self) -> Result<(), Refusal>

Source§

fn get_at(&self, path: &[Segment]) -> Option<&dyn Any>

Source§

fn diff<R>(&self, after: &Self, path: &[Segment], out: &mut Vec<Edit<R>>)

Source§

fn load(doc: &Doc, value: &Value<'_>, id: &ObjId) -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

fn store_changed( &self, before: &Self, doc: &mut Doc, slot: Slot<'_>, dirty: &Delta, ) -> Result<(), ModelError>

Source§

fn refresh( &mut self, doc: &Doc, value: &Value<'_>, id: &ObjId, delta: &Delta, ) -> Result<(), ModelError>

Source§

fn collect_text(&self, out: &mut Vec<String>)

Source§

fn missing() -> Result<Self, ModelError>

Source§

impl Model for Actor

Source§

const SCALAR: bool = true

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, Actor>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(_: &Doc, value: &Value<'_>, _: &ObjId) -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn fresh(&self, _: TextEncoding) -> Fresh

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

impl Model for AppId

Source§

const SCALAR: bool = true

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, AppId>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(_: &Doc, value: &Value<'_>, _: &ObjId) -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn fresh(&self, _: TextEncoding) -> Fresh

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

impl Model for Date

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, Date>

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(_: &Doc, value: &Value<'_>, _: &ObjId) -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn collect_text(&self, out: &mut Vec<String>)

Source§

impl Model for DateTime

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, DateTime>

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(_: &Doc, value: &Value<'_>, _: &ObjId) -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn collect_text(&self, out: &mut Vec<String>)

Source§

impl Model for Grantee

Source§

const SCALAR: bool = true

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, Grantee>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(_: &Doc, value: &Value<'_>, _: &ObjId) -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn fresh(&self, _: TextEncoding) -> Fresh

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

impl Model for Lifetime

Source§

const SCALAR: bool = true

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, Lifetime>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(_: &Doc, value: &Value<'_>, _: &ObjId) -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn fresh(&self, _: TextEncoding) -> Fresh

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

impl Model for Map<String, Value>

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, Map<String, Value>>

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn value_schema() -> Value

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(doc: &Doc, value: &Value<'_>, id: &ObjId) -> Result<Self, ModelError>

Source§

fn missing() -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

impl Model for String

Source§

fn fresh(&self, encoding: TextEncoding) -> Fresh

Its text, made marked as its writer’s.

Source§

fn store_changed( &self, before: &Self, doc: &mut Doc, slot: Slot<'_>, _dirty: &Delta, ) -> Result<(), ModelError>

The one splice store makes, found from before instead of reading the whole text back.

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, String>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn edit( doc: &mut Doc, slot: Slot<'_>, path: &[Segment], op: &EditOp, _cx: &mut ActionCx, ) -> Result<(), ModelError>

Source§

fn load(doc: &Doc, value: &Value<'_>, id: &ObjId) -> Result<Self, ModelError>

Source§

fn missing() -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

fn collect_text(&self, out: &mut Vec<String>)

Source§

impl Model for Time

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, Time>

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(_: &Doc, value: &Value<'_>, _: &ObjId) -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn collect_text(&self, out: &mut Vec<String>)

Source§

impl Model for Uuid

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, Uuid>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(_: &Doc, value: &Value<'_>, _: &ObjId) -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

impl Model for Value

Source§

fn fresh(&self, _: TextEncoding) -> Fresh

Made with the map as the maps, lists and scalars Self::store writes.

Source§

const TABLE: &'static ModelTable

Source§

const NULLABLE: bool = true

Source§

type Paths<R> = Path<R, Value>

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(doc: &Doc, value: &Value<'_>, id: &ObjId) -> Result<Self, ModelError>

Source§

fn missing() -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

impl Model for bool

Source§

const SCALAR: bool = true

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, bool>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(_: &Doc, value: &Value<'_>, _: &ObjId) -> Result<Self, ModelError>

Source§

fn missing() -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn fresh(&self, _: TextEncoding) -> Fresh

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

impl Model for f32

Source§

const SCALAR: bool = true

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, f32>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(doc: &Doc, value: &Value<'_>, id: &ObjId) -> Result<Self, ModelError>

Source§

fn missing() -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn fresh(&self, encoding: TextEncoding) -> Fresh

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

impl Model for f64

Source§

const SCALAR: bool = true

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, f64>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(_: &Doc, value: &Value<'_>, _: &ObjId) -> Result<Self, ModelError>

Source§

fn missing() -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn fresh(&self, _: TextEncoding) -> Fresh

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

impl Model for i8

Source§

const SCALAR: bool = true

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, i8>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(_: &Doc, value: &Value<'_>, _: &ObjId) -> Result<Self, ModelError>

Source§

fn missing() -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn fresh(&self, _: TextEncoding) -> Fresh

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

impl Model for i16

Source§

const SCALAR: bool = true

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, i16>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(_: &Doc, value: &Value<'_>, _: &ObjId) -> Result<Self, ModelError>

Source§

fn missing() -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn fresh(&self, _: TextEncoding) -> Fresh

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

impl Model for i32

Source§

const SCALAR: bool = true

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, i32>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(_: &Doc, value: &Value<'_>, _: &ObjId) -> Result<Self, ModelError>

Source§

fn missing() -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn fresh(&self, _: TextEncoding) -> Fresh

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

impl Model for i64

Source§

const SCALAR: bool = true

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, i64>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(_: &Doc, value: &Value<'_>, _: &ObjId) -> Result<Self, ModelError>

Source§

fn missing() -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn fresh(&self, _: TextEncoding) -> Fresh

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

impl Model for isize

Source§

const SCALAR: bool = true

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, isize>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(_: &Doc, value: &Value<'_>, _: &ObjId) -> Result<Self, ModelError>

Source§

fn missing() -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn fresh(&self, _: TextEncoding) -> Fresh

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

impl Model for u8

Source§

const SCALAR: bool = true

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, u8>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(_: &Doc, value: &Value<'_>, _: &ObjId) -> Result<Self, ModelError>

Source§

fn missing() -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn fresh(&self, _: TextEncoding) -> Fresh

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

impl Model for u16

Source§

const SCALAR: bool = true

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, u16>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(_: &Doc, value: &Value<'_>, _: &ObjId) -> Result<Self, ModelError>

Source§

fn missing() -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn fresh(&self, _: TextEncoding) -> Fresh

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

impl Model for u32

Source§

const SCALAR: bool = true

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, u32>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(_: &Doc, value: &Value<'_>, _: &ObjId) -> Result<Self, ModelError>

Source§

fn missing() -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn fresh(&self, _: TextEncoding) -> Fresh

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

impl Model for u64

Source§

const SCALAR: bool = true

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, u64>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(_: &Doc, value: &Value<'_>, _: &ObjId) -> Result<Self, ModelError>

Source§

fn missing() -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn fresh(&self, _: TextEncoding) -> Fresh

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

impl Model for usize

Source§

const SCALAR: bool = true

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, usize>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(_: &Doc, value: &Value<'_>, _: &ObjId) -> Result<Self, ModelError>

Source§

fn missing() -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn fresh(&self, _: TextEncoding) -> Fresh

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

impl<T: Model, const N: usize> Model for [T; N]

Source§

const CHECKS: bool = T::CHECKS

Source§

const OPS: bool = T::OPS

Source§

type Paths<R> = Path<R, [T; N]>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn load(doc: &Doc, value: &Value<'_>, id: &ObjId) -> Result<Self, ModelError>

Source§

fn missing() -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

impl<T: Model> Model for BTreeMap<String, T>

Source§

const SHAPE: Shape

Source§

const CHECKS: bool = T::CHECKS

Source§

const OPS: bool = T::OPS

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, BTreeMap<String, T>>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn op_coalesces( path: &[Segment], previous: &Value, next: &Value, ) -> Option<bool>

Source§

fn op_continuable(path: &[Segment], op: &Value) -> Option<bool>

Source§

fn op_describe(path: &[Segment], op: &Value) -> Option<OpDescription>

Source§

fn op_lands(&self, path: &[Segment], op: &Value) -> Option<Place>

Source§

fn op_schemas(prefix: &str, out: &mut Vec<(String, Value)>)

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn edit( doc: &mut Doc, slot: Slot<'_>, path: &[Segment], op: &EditOp, cx: &mut ActionCx, ) -> Result<(), ModelError>

Source§

fn check(&self) -> Result<(), Refusal>

Source§

fn get_at(&self, path: &[Segment]) -> Option<&dyn Any>

Source§

fn diff<R>(&self, after: &Self, path: &[Segment], out: &mut Vec<Edit<R>>)

Source§

fn load(doc: &Doc, value: &Value<'_>, id: &ObjId) -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

fn store_changed( &self, before: &Self, doc: &mut Doc, slot: Slot<'_>, dirty: &Delta, ) -> Result<(), ModelError>

Source§

fn refresh( &mut self, doc: &Doc, value: &Value<'_>, id: &ObjId, delta: &Delta, ) -> Result<(), ModelError>

Source§

fn collect_text(&self, out: &mut Vec<String>)

Source§

fn missing() -> Result<Self, ModelError>

Source§

impl<T: Model> Model for Box<T>

Source§

const SCALAR: bool = T::SCALAR

Source§

const SHAPE: Shape = T::SHAPE

Source§

const CHECKS: bool = T::CHECKS

Source§

const OPS: bool = T::OPS

Source§

const NULLABLE: bool = T::NULLABLE

Source§

type Paths<R> = <T as Model>::Paths<R>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn op_coalesces( path: &[Segment], previous: &Value, next: &Value, ) -> Option<bool>

Source§

fn op_continuable(path: &[Segment], op: &Value) -> Option<bool>

Source§

fn op_describe(path: &[Segment], op: &Value) -> Option<OpDescription>

Source§

fn op_lands(&self, path: &[Segment], op: &Value) -> Option<Place>

Source§

fn op_schemas(prefix: &str, out: &mut Vec<(String, Value)>)

Source§

fn paths_at<R>(path: Path<R, Self>) -> T::Paths<R>

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn edit( doc: &mut Doc, slot: Slot<'_>, path: &[Segment], op: &EditOp, cx: &mut ActionCx, ) -> Result<(), ModelError>

Source§

fn check(&self) -> Result<(), Refusal>

Source§

fn diff<R>(&self, after: &Self, path: &[Segment], out: &mut Vec<Edit<R>>)

Source§

fn label(&self) -> Option<String>

Source§

fn get_at(&self, path: &[Segment]) -> Option<&dyn Any>
where Self: 'static,

Source§

fn load(doc: &Doc, value: &Value<'_>, id: &ObjId) -> Result<Self, ModelError>

Source§

fn missing() -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

fn store_changed( &self, before: &Self, doc: &mut Doc, slot: Slot<'_>, dirty: &Delta, ) -> Result<(), ModelError>

Source§

fn refresh( &mut self, doc: &Doc, value: &Value<'_>, id: &ObjId, delta: &Delta, ) -> Result<(), ModelError>

Source§

fn collect_text(&self, out: &mut Vec<String>)

Source§

impl<T: Model> Model for Option<T>

Source§

const SHAPE: Shape = T::SHAPE

Source§

const CHECKS: bool = T::CHECKS

Source§

const OPS: bool = T::OPS

Source§

const NULLABLE: bool = true

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, Option<T>>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn op_coalesces( path: &[Segment], previous: &Value, next: &Value, ) -> Option<bool>

Source§

fn op_continuable(path: &[Segment], op: &Value) -> Option<bool>

Source§

fn op_describe(path: &[Segment], op: &Value) -> Option<OpDescription>

Source§

fn op_lands(&self, path: &[Segment], op: &Value) -> Option<Place>

Source§

fn op_schemas(prefix: &str, out: &mut Vec<(String, Value)>)

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn edit( doc: &mut Doc, slot: Slot<'_>, path: &[Segment], op: &EditOp, cx: &mut ActionCx, ) -> Result<(), ModelError>

Source§

fn check(&self) -> Result<(), Refusal>

Source§

fn get_at(&self, path: &[Segment]) -> Option<&dyn Any>

Source§

fn diff<R>(&self, after: &Self, path: &[Segment], out: &mut Vec<Edit<R>>)

Source§

fn load(doc: &Doc, value: &Value<'_>, id: &ObjId) -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

fn store_changed( &self, before: &Self, doc: &mut Doc, slot: Slot<'_>, dirty: &Delta, ) -> Result<(), ModelError>

Source§

fn refresh( &mut self, doc: &Doc, value: &Value<'_>, id: &ObjId, delta: &Delta, ) -> Result<(), ModelError>

Source§

fn collect_text(&self, out: &mut Vec<String>)

Source§

fn label(&self) -> Option<String>

Source§

fn missing() -> Result<Self, ModelError>

Source§

impl<T: Model> Model for Vec<T>

Source§

const CHECKS: bool = T::CHECKS

Source§

const OPS: bool = T::OPS

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, Vec<T>>

Source§

fn value_schema() -> Value

Source§

fn field_type(types: &mut TypeSet) -> FieldType

Source§

fn paths_at<R>(path: Path<R, Self>) -> Path<R, Self>

Source§

fn op_coalesces( path: &[Segment], previous: &Value, next: &Value, ) -> Option<bool>

Source§

fn op_continuable(path: &[Segment], op: &Value) -> Option<bool>

Source§

fn op_describe(path: &[Segment], op: &Value) -> Option<OpDescription>

Source§

fn op_lands(&self, path: &[Segment], op: &Value) -> Option<Place>

Source§

fn op_schemas(prefix: &str, out: &mut Vec<(String, Value)>)

Source§

fn to_json(&self) -> Value

Source§

fn from_json(value: &Value) -> Result<Self, ModelError>

Source§

fn edit( doc: &mut Doc, slot: Slot<'_>, path: &[Segment], op: &EditOp, cx: &mut ActionCx, ) -> Result<(), ModelError>

Source§

fn check(&self) -> Result<(), Refusal>

Source§

fn get_at(&self, path: &[Segment]) -> Option<&dyn Any>

Source§

fn diff<R>(&self, after: &Self, path: &[Segment], out: &mut Vec<Edit<R>>)

Source§

fn load(doc: &Doc, value: &Value<'_>, id: &ObjId) -> Result<Self, ModelError>

Source§

fn store(&self, doc: &mut Doc, slot: Slot<'_>) -> Result<(), ModelError>

Source§

fn stores_as(&self, before: &Self) -> bool

Source§

fn store_changed( &self, before: &Self, doc: &mut Doc, slot: Slot<'_>, dirty: &Delta, ) -> Result<(), ModelError>

Source§

fn refresh( &mut self, doc: &Doc, value: &Value<'_>, id: &ObjId, delta: &Delta, ) -> Result<(), ModelError>

Source§

fn collect_text(&self, out: &mut Vec<String>)

Source§

fn missing() -> Result<Self, ModelError>

Implementors§

Source§

impl Model for Acting

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, Acting>

Source§

impl Model for ActionKey

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, ActionKey>

Source§

impl Model for Atom

Source§

const SCALAR: bool = true

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, Atom>

Source§

impl Model for Bytes

Source§

const TABLE: &'static ModelTable

Source§

const NULLABLE: bool = true

Source§

type Paths<R> = Path<R, Bytes>

Source§

impl Model for ChildRef

Source§

impl Model for Counter

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, Counter>

Source§

impl Model for Id

Source§

const SCALAR: bool = true

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, Id>

Source§

impl Model for MemberId

Source§

const SCALAR: bool = true

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, MemberId>

Source§

impl Model for Origin

Source§

impl Model for Reaction

Source§

impl Model for Reactions

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, Reactions>

Source§

impl Model for Trashed

Source§

impl<O: Serialize + DeserializeOwned + Default + 'static> Model for Settled<O>

A settlement stores as one JSON value: it is written once, by the owning device.

Source§

type Paths<R> = Path<R, Settled<O>>

Source§

impl<T: Model + Identified, S: ItemStorage> Model for Items<T, S>

Source§

const SHAPE: Shape

Source§

const CHECKS: bool = T::CHECKS

Source§

const OPS: bool = T::OPS

Source§

type Paths<R> = Path<R, Items<T, S>>

Source§

impl<T: Model, O: Serialize + DeserializeOwned + Default + 'static> Model for Outbox<T, O>

Source§

const CHECKS: bool = T::CHECKS

Source§

const OPS: bool = T::OPS

Source§

type Paths<R> = Path<R, Outbox<T, O>>

Source§

impl<T: Model, O: Serialize + DeserializeOwned + Default + 'static> Model for OutboxEntry<T, O>

Source§

const CHECKS: bool = T::CHECKS

Source§

const OPS: bool = T::OPS

Source§

type Paths<R> = Path<R, OutboxEntry<T, O>>

Source§

impl<T: Model> Model for Collection<T>

Source§

const SHAPE: Shape

Source§

const CHECKS: bool = T::CHECKS

Source§

const OPS: bool = T::OPS

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, Collection<T>>

Source§

impl<T: Model> Model for Grid<T>

Source§

const CHECKS: bool = T::CHECKS

Source§

const OPS: bool = T::OPS

Source§

type Paths<R> = Path<R, Grid<T>>

Source§

impl<T: Model> Model for tilo_resource::Map<T>

Source§

const SHAPE: Shape

Source§

const CHECKS: bool = T::CHECKS

Source§

const OPS: bool = T::OPS

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, Map<T>>

Source§

impl<T: Model> Model for Set<T>

Source§

const CHECKS: bool = T::CHECKS

Source§

const OPS: bool = T::OPS

Source§

const TABLE: &'static ModelTable

Source§

type Paths<R> = Path<R, Set<T>>

Source§

impl<T: Serialize + DeserializeOwned + 'static, const KEEP: usize> Model for Recents<T, KEEP>

Stored as one JSON value, written whole.

Source§

type Paths<R> = Path<R, Recents<T, KEEP>>