[][src]Struct ledb::RawDocument

pub struct RawDocument(_, _);

Raw document with id representation

Implementations

impl RawDocument[src]

pub fn new(doc: Value) -> Self[src]

Create document using raw data

pub fn with_id(self, id: Primary) -> Self[src]

Add id to document

pub fn without_id(self) -> Self[src]

Remove id from document

pub fn has_id(&self) -> bool[src]

Checks when document has primary key/identifier

pub fn get_id(&self) -> &Option<Primary>[src]

Get the primary key/identifier of document

pub fn req_id(&self) -> Result<Primary>[src]

Require the primary key/identifier of document

pub fn into_inner(self) -> Value[src]

Unwrap document value

pub fn to_bin(&self) -> Result<Vec<u8>>[src]

Convert document to binary representation

At this moment we use CBOR for effectively store documents into DB backend. Since the internal representation does not contains primary identifier, it adds on reading documents from DB.

pub fn from_bin(raw: &[u8]) -> Result<Self>[src]

Restore document from binary representation

At this moment we use CBOR for effectively store documents into DB backend. Since the internal representation does not contains primary identifier, it adds on reading documents from DB.

pub fn from_doc<T>(doc: &T) -> Result<Self> where
    T: Serialize + Document + Sized
[src]

Convert typed document to raw representation

Typically the application deals with typed documents which represented by specific structures. The database backend processes generic document representation which is CBOR Value.

pub fn into_doc<T>(self) -> Result<T> where
    T: DeserializeOwned + Document
[src]

Restore typed document from raw representation

Typically the application deals with typed documents which represented by specific structures. The database backend processes generic document representation which is CBOR Value.

Trait Implementations

impl Clone for RawDocument[src]

impl Debug for RawDocument[src]

impl Deref for RawDocument[src]

type Target = Value

The resulting type after dereferencing.

impl DerefMut for RawDocument[src]

impl PartialEq<RawDocument> for RawDocument[src]

impl StructuralPartialEq for RawDocument[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<'a, T> DefaultFeatures<'a> for T where
    T: 'a + Clone + Send + Sync
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<'a, T> NonSyncFeatures<'a> for T where
    T: 'a + Clone
[src]

impl<T> SafeBorrow<T> for T where
    T: ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.