pub struct CouchbaseMap<'a> { /* private fields */ }Expand description
A map (JSON object) data structure backed by a document in a collection.
Supports get, insert, remove, keys, values, exists, size, clear, and iteration.
Implementations§
Source§impl CouchbaseMap<'_>
impl CouchbaseMap<'_>
Sourcepub async fn iter<T: DeserializeOwned>(
&self,
) -> Result<impl Iterator<Item = (String, T)>>
pub async fn iter<T: DeserializeOwned>( &self, ) -> Result<impl Iterator<Item = (String, T)>>
Returns an iterator over all key-value pairs in the map.
Sourcepub async fn get<V: DeserializeOwned>(&self, id: impl Into<String>) -> Result<V>
pub async fn get<V: DeserializeOwned>(&self, id: impl Into<String>) -> Result<V>
Gets the value associated with the given key.
Sourcepub async fn insert<V: Serialize>(
&self,
id: impl Into<String>,
value: V,
) -> Result<()>
pub async fn insert<V: Serialize>( &self, id: impl Into<String>, value: V, ) -> Result<()>
Inserts or updates a key-value pair in the map. Creates the map if it doesn’t exist.
Sourcepub async fn remove(&self, id: impl Into<String>) -> Result<()>
pub async fn remove(&self, id: impl Into<String>) -> Result<()>
Removes the entry with the given key from the map.
Sourcepub async fn contains_key(&self, id: impl Into<String>) -> Result<bool>
pub async fn contains_key(&self, id: impl Into<String>) -> Result<bool>
Returns true if the map contains the given key.
Sourcepub async fn values<T: DeserializeOwned>(&self) -> Result<Vec<T>>
pub async fn values<T: DeserializeOwned>(&self) -> Result<Vec<T>>
Returns all values in the map.
Trait Implementations§
Source§impl<'a> Clone for CouchbaseMap<'a>
impl<'a> Clone for CouchbaseMap<'a>
Source§fn clone(&self) -> CouchbaseMap<'a>
fn clone(&self) -> CouchbaseMap<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for CouchbaseMap<'a>
impl<'a> !RefUnwindSafe for CouchbaseMap<'a>
impl<'a> Send for CouchbaseMap<'a>
impl<'a> Sync for CouchbaseMap<'a>
impl<'a> Unpin for CouchbaseMap<'a>
impl<'a> UnsafeUnpin for CouchbaseMap<'a>
impl<'a> !UnwindSafe for CouchbaseMap<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more