Document

Struct Document 

Source
pub struct Document { /* private fields */ }

Implementations§

Source§

impl Document

Source

pub fn new<T>(data: &T, enc: FlEncoderSession) -> Result<Self, Error>
where T: Serialize,

Source

pub fn new_with_id<S, T>( doc_id: S, data: &T, enc: FlEncoderSession, ) -> Result<Self, Error>
where S: Into<String>, T: Serialize,

Source

pub fn new_with_id_fleece<S: Into<String>>( doc_id: S, fleece_data: FLSliceResult, ) -> Self

Source

pub fn id(&self) -> &str

return the document’s ID

Source

pub fn decode_body<T: DeserializeOwned>(self) -> Result<T, Error>

Decode body of document

Source

pub fn update_body<T>( &mut self, data: &T, enc: FlEncoderSession, ) -> Result<(), Error>
where T: Serialize,

Update internal buffer with data, you need save document to database to make this change permanent

Source

pub fn sequence(&self) -> Option<u64>

Returns a document’s current sequence in the local database. This number increases every time the document is saved, and a more recently saved document will have a greater sequence number than one saved earlier, so sequences may be used as an abstract ‘clock’ to tell relative modification times

Source

pub fn revision_id(&self) -> Option<&str>

Returns a document’s revision ID, which is a short opaque string that’s guaranteed to be unique to every change made to the document.

Source

pub fn flags(&self) -> Option<DocumentFlags>

Source

pub fn generation(&self) -> c_uint

Source

pub fn exists(&self) -> bool

Just check Document::flags to see if document exists

Trait Implementations§

Source§

impl Debug for Document

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V