Struct bonsaidb_core::document::OwnedDocument
source · [−]Expand description
Contains a serialized document in the database.
Fields
header: HeaderThe header of the document, which contains the id and Revision.
contents: BytesThe serialized bytes of the stored item.
Methods from Deref<Target = Header>
sourcepub fn emit_key<K: for<'a> Key<'a>>(&self, key: K) -> Mappings<K, ()>
pub fn emit_key<K: for<'a> Key<'a>>(&self, key: K) -> Mappings<K, ()>
Creates a Map result with a key and an empty value.
sourcepub fn emit_value<Value>(&self, value: Value) -> Mappings<(), Value>
pub fn emit_value<Value>(&self, value: Value) -> Mappings<(), Value>
Creates a Map result with value and an empty key.
sourcepub 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
sourceimpl Clone for OwnedDocument
impl Clone for OwnedDocument
sourcefn clone(&self) -> OwnedDocument
fn clone(&self) -> OwnedDocument
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for OwnedDocument
impl Debug for OwnedDocument
sourceimpl Deref for OwnedDocument
impl Deref for OwnedDocument
sourceimpl DerefMut for OwnedDocument
impl DerefMut for OwnedDocument
sourceimpl<'de> Deserialize<'de> for OwnedDocument
impl<'de> Deserialize<'de> for OwnedDocument
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Document<'static> for OwnedDocument
impl Document<'static> for OwnedDocument
sourcefn new(id: u64, contents: impl Into<Self::Bytes>) -> Self
fn new(id: u64, contents: impl Into<Self::Bytes>) -> Self
Creates a new document with contents.
sourcefn with_contents<S: SerializedCollection<Contents = S>>(
id: u64,
contents: &S
) -> Result<Self, Error>
fn with_contents<S: SerializedCollection<Contents = S>>(
id: u64,
contents: &S
) -> Result<Self, Error>
Creates a new document with serialized bytes from contents.
sourcefn contents<D>(&self) -> Result<D::Contents, Error> where
D: SerializedCollection<Contents = D>,
fn contents<D>(&self) -> Result<D::Contents, Error> where
D: SerializedCollection<Contents = D>,
Retrieves contents through deserialization into the type D.
sourcefn set_contents<S: SerializedCollection<Contents = S>>(
&mut self,
contents: &S
) -> Result<(), Error>
fn set_contents<S: SerializedCollection<Contents = S>>(
&mut self,
contents: &S
) -> Result<(), Error>
Serializes and stores contents into this document.
sourceimpl Serialize for OwnedDocument
impl Serialize for OwnedDocument
sourceimpl<'a, C> TryFrom<&'a OwnedDocument> for CollectionDocument<C> where
C: SerializedCollection,
impl<'a, C> TryFrom<&'a OwnedDocument> for CollectionDocument<C> where
C: SerializedCollection,
Auto Trait Implementations
impl RefUnwindSafe for OwnedDocument
impl Send for OwnedDocument
impl Sync for OwnedDocument
impl Unpin for OwnedDocument
impl UnwindSafe for OwnedDocument
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more