Trait dittolive_ditto::store::collection::document::DittoMutDocument
source · [−]pub trait DittoMutDocument: DittoDocument {
fn set<V: Serialize>(
&mut self,
path: &str,
val: V
) -> Result<(), DittoError>;
fn set_as_default<V: Serialize>(
&mut self,
path: &str,
val: V
) -> Result<(), DittoError>;
fn push<V: Serialize>(
&mut self,
path: &str,
val: V
) -> Result<(), DittoError>;
fn insert<V: Serialize>(
&mut self,
path: &str,
val: V
) -> Result<(), DittoError>;
fn pop<T>(&mut self, path: &str) -> Result<T, DittoError>
where
T: for<'de> Deserialize<'de>;
fn remove(&mut self, path: &str) -> Result<(), DittoError>;
fn replace_with_counter(
&mut self,
path: &str,
is_default: bool
) -> Result<(), DittoError>;
fn increment(&mut self, path: &str, amount: f64) -> Result<(), DittoError>;
}
Required methods
Assigns a some serializable value to the document at the given path and removes any other information present at that path If the path does not exist it will be created.
fn set_as_default<V: Serialize>(
&mut self,
path: &str,
val: V
) -> Result<(), DittoError>
fn set_as_default<V: Serialize>(
&mut self,
path: &str,
val: V
) -> Result<(), DittoError>
Sets the value at the provided path and marks it as the default, indicating other peers in the network are expected to overwrite it.
Given a path
to an array inside a document, appends value to the
array. An error will be returned if the path does not in fact point
to an array.
Inserts a value
at the provided path and *will not remove other
descendant items at that path.
fn pop<T>(&mut self, path: &str) -> Result<T, DittoError> where
T: for<'de> Deserialize<'de>,
fn pop<T>(&mut self, path: &str) -> Result<T, DittoError> where
T: for<'de> Deserialize<'de>,
Removes and returns the last item at a path within a document if that path is to an array.
Remove the value from a document at a given path