Struct pliantdb_local::core::document::Document [−][src]
Contains a serialized document in the database.
Fields
collection: IdThe Id of the Collection this document belongs to.
header: Cow<'a, Header>The header of the document, which contains the id and Revision.
contents: Cow<'a, [u8]>The serialized bytes of the stored item.
Implementations
impl<'a> Document<'a>[src]
#[must_use]pub fn new(id: u64, contents: Cow<'a, [u8]>, collection: Id) -> Document<'a>[src]
Creates a new document with contents.
pub fn with_contents<S>(
id: u64,
contents: &S,
collection: Id
) -> Result<Document<'a>, Error> where
S: Serialize, [src]
id: u64,
contents: &S,
collection: Id
) -> Result<Document<'a>, Error> where
S: Serialize,
Creates a new document with serialized bytes from contents.
pub fn contents<D>(&'a self) -> Result<D, Error> where
D: Deserialize<'a>, [src]
D: Deserialize<'a>,
Retrieves contents through deserialization into the type D.
pub fn set_contents<S>(&mut self, contents: &S) -> Result<(), Error> where
S: Serialize, [src]
S: Serialize,
Serializes and stores contents into this document.
#[must_use]pub fn create_new_revision(
&self,
contents: Cow<'a, [u8]>
) -> Option<Document<'a>>[src]
&self,
contents: Cow<'a, [u8]>
) -> Option<Document<'a>>
Creates a new revision.
WARNING: This normally should not be used outside of implementing a
backend for PliantDB. To update a document, use set_contents() and
send the document with the existing Revision information.
#[must_use]pub fn emit(&self) -> Map<(), ()>[src]
Creates a Map result with an empty key and value.
#[must_use]pub fn emit_key<Key>(&self, key: Key) -> Map<Key, ()> where
Key: Key, [src]
Key: Key,
Creates a Map result with a key and an empty value.
#[must_use]pub fn emit_value<Value>(&self, value: Value) -> Map<(), Value> where
Value: Serialize, [src]
Value: Serialize,
Creates a Map result with value and an empty key.
#[must_use]pub fn emit_key_and_value<Key, Value>(
&self,
key: Key,
value: Value
) -> Map<Key, Value> where
Key: Key,
Value: Serialize, [src]
&self,
key: Key,
value: Value
) -> Map<Key, Value> where
Key: Key,
Value: Serialize,
Creates a Map result with a key and value.
#[must_use]pub fn to_owned(&self) -> Document<'static>[src]
Clone the document’s data so that it’s no longer borrowed in the original lifetime 'a.
Trait Implementations
impl<'a> Clone for Document<'a>[src]
impl<'a> Debug for Document<'a>[src]
impl<'de, 'a> Deserialize<'de> for Document<'a>[src]
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Document<'a>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>, [src]
__deserializer: __D
) -> Result<Document<'a>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
impl<'a> Serialize for Document<'a>[src]
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer, [src]
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Auto Trait Implementations
impl<'a> RefUnwindSafe for Document<'a>
impl<'a> Send for Document<'a>
impl<'a> Sync for Document<'a>
impl<'a> Unpin for Document<'a>
impl<'a> UnwindSafe for Document<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>, [src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T[src]
impl<T> Instrument for T[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>[src]
pub fn in_current_span(self) -> Instrumented<Self>[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,