Struct bonsaidb_core::document::CollectionDocument
source · [−]pub struct CollectionDocument<C> where
C: SerializedCollection, {
pub header: Header,
pub contents: C::Contents,
}Expand description
A document with serializable contents.
Fields
header: HeaderThe header of the document, which contains the id and Revision.
contents: C::ContentsThe document’s contents.
Implementations
Stores the new value of contents in the document.
Modifies self, automatically retrying the modification if the document
has been updated on the server.
Data loss warning
If you’ve modified self before calling this function and a conflict
occurs, all changes to self will be lost when the current document is
fetched before retrying the process again. When you use this function,
you should limit the edits to the value to within the modifier
callback.
Removes the document from the collection.
Converts this value to a serialized Document.
Methods from Deref<Target = Header>
Creates a Map result with a key and an empty value.
Creates a Map result with value and an empty key.
pub fn emit_key_and_value<K: for<'a> Key<'a>, Value>(
&self,
key: K,
value: Value
) -> Mappings<K, Value>
pub fn emit_key_and_value<K: for<'a> Key<'a>, Value>(
&self,
key: K,
value: Value
) -> Mappings<K, Value>
Creates a Map result with a key and value.
Trait Implementations
impl<C: Clone> Clone for CollectionDocument<C> where
C: SerializedCollection,
C::Contents: Clone,
impl<C: Clone> Clone for CollectionDocument<C> where
C: SerializedCollection,
C::Contents: Clone,
impl<C: Debug> Debug for CollectionDocument<C> where
C: SerializedCollection,
C::Contents: Debug,
impl<C: Debug> Debug for CollectionDocument<C> where
C: SerializedCollection,
C::Contents: Debug,
impl<'a, 'c, C> From<&'c CollectionDocument<C>> for NamedReference<'a> where
C: SerializedCollection,
impl<'a, 'c, C> From<&'c CollectionDocument<C>> for NamedReference<'a> where
C: SerializedCollection,
Performs the conversion.
impl<C: PartialEq> PartialEq<CollectionDocument<C>> for CollectionDocument<C> where
C: SerializedCollection,
C::Contents: PartialEq,
impl<C: PartialEq> PartialEq<CollectionDocument<C>> for CollectionDocument<C> where
C: SerializedCollection,
C::Contents: PartialEq,
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
impl<'a, C> TryFrom<&'a BorrowedDocument<'a>> for CollectionDocument<C> where
C: SerializedCollection,
impl<'a, C> TryFrom<&'a BorrowedDocument<'a>> for CollectionDocument<C> where
C: SerializedCollection,
impl<'a, C> TryFrom<&'a OwnedDocument> for CollectionDocument<C> where
C: SerializedCollection,
impl<'a, C> TryFrom<&'a OwnedDocument> for CollectionDocument<C> where
C: SerializedCollection,
impl<'a, 'b, C> TryFrom<&'b CollectionDocument<C>> for BorrowedDocument<'a> where
C: SerializedCollection,
impl<'a, 'b, C> TryFrom<&'b CollectionDocument<C>> for BorrowedDocument<'a> where
C: SerializedCollection,
Auto Trait Implementations
impl<C> RefUnwindSafe for CollectionDocument<C> where
<C as SerializedCollection>::Contents: RefUnwindSafe,
impl<C> Send for CollectionDocument<C>
impl<C> Sync for CollectionDocument<C>
impl<C> Unpin for CollectionDocument<C> where
<C as SerializedCollection>::Contents: Unpin,
impl<C> UnwindSafe for CollectionDocument<C> where
<C as SerializedCollection>::Contents: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more