Trait bonsaidb::core::document::Document[][src]

pub trait Document<C> where
    C: Collection
{ type Bytes; fn id(&self) -> DocumentId;
fn header(&self) -> AnyHeader<<C as Collection>::PrimaryKey>;
fn set_header(&mut self, header: Header) -> Result<(), Error>;
fn bytes(&self) -> Result<Vec<u8, Global>, Error>;
fn contents(&self) -> Result<<C as SerializedCollection>::Contents, Error>
        C: SerializedCollection
fn set_contents(
        &mut self,
        contents: <C as SerializedCollection>::Contents
    ) -> Result<(), Error>
        C: SerializedCollection
; fn set_collection_header(
        &mut self,
        header: CollectionHeader<<C as Collection>::PrimaryKey>
    ) -> Result<(), Error> { ... } }
Expand description

Common interface of a document in BonsaiDb.

Associated Types

The bytes type used in the interface.

Required methods

Returns the unique key for this document.

Returns the header of this document.

Sets the header to the new header.

Returns the contents of this document, serialized.

Retrieves contents through deserialization into the type D.

Stores contents into this document.

Provided methods

Sets the header to the new collection header.