Trait dittolive_ditto::store::collection::document::DittoDocument[][src]

pub trait DittoDocument {
    fn id(&self) -> DocumentId;
fn to_cbor(&self) -> Result<Value, DittoError>;
fn get<V: for<'de> Deserialize<'de>>(
        path: &str
    ) -> Result<V, DittoError>;
fn typed<T: for<'de> Deserialize<'de>>(&self) -> Result<T, DittoError>; }

Required methods

Returns the ID of the document

Renders the document as a CBOR value

Returns the value at a given path in the document The parameter V represents the type expected at the given path. Note however that other peers may have changed this type and deserialization may fail. In this case provide a general type like serde_cbor::Value

Decodes a document into a user-provided type provided that type implements serde::Deserialize Note that this is a snapshot of the current state of the Document, which may be later modified by other peers