pub struct Hashmap<T> { /* private fields */ }
Expand description
Hashmap opened by RedisObjects::hashmap
Implementations§
Source§impl<T: Serialize + DeserializeOwned> Hashmap<T>
impl<T: Serialize + DeserializeOwned> Hashmap<T>
Sourcepub async fn add(&self, key: &str, value: &T) -> Result<bool, ErrorTypes>
pub async fn add(&self, key: &str, value: &T) -> Result<bool, ErrorTypes>
Add the (key, value) pair to the hash for new keys. If a key already exists this operation doesn’t add it. Returns true if key has been added to the table, False otherwise.
Sourcepub async fn increment(
&self,
key: &str,
increment: i64,
) -> Result<i64, ErrorTypes>
pub async fn increment( &self, key: &str, increment: i64, ) -> Result<i64, ErrorTypes>
Increment a key within a hash by the given delta
Sourcepub async fn exists(&self, key: &str) -> Result<bool, ErrorTypes>
pub async fn exists(&self, key: &str) -> Result<bool, ErrorTypes>
Test if a given key is defind within this hash
Sourcepub async fn get(&self, key: &str) -> Result<Option<T>, ErrorTypes>
pub async fn get(&self, key: &str) -> Result<Option<T>, ErrorTypes>
Read the value stored at the given key
Sourcepub async fn get_raw(&self, key: &str) -> Result<Option<Vec<u8>>, ErrorTypes>
pub async fn get_raw(&self, key: &str) -> Result<Option<Vec<u8>>, ErrorTypes>
Read the value stored at the given key
Sourcepub async fn length(&self) -> Result<u64, ErrorTypes>
pub async fn length(&self) -> Result<u64, ErrorTypes>
Read the number of items in the hash
Sourcepub async fn items(&self) -> Result<HashMap<String, T>, ErrorTypes>
pub async fn items(&self) -> Result<HashMap<String, T>, ErrorTypes>
Download the entire hash into memory
Sourcepub async fn conditional_remove(
&self,
key: &str,
value: &T,
) -> Result<bool, ErrorTypes>
pub async fn conditional_remove( &self, key: &str, value: &T, ) -> Result<bool, ErrorTypes>
Remove an item, but only if its value is as given
Sourcepub async fn pop(&self, key: &str) -> Result<Option<T>, ErrorTypes>
pub async fn pop(&self, key: &str) -> Result<Option<T>, ErrorTypes>
Remove and return the item in the hash if found
Sourcepub async fn set(&self, key: &str, value: &T) -> Result<i64, ErrorTypes>
pub async fn set(&self, key: &str, value: &T) -> Result<i64, ErrorTypes>
Unconditionally overwrite the value stored at a given key
Sourcepub async fn delete(&self) -> Result<(), ErrorTypes>
pub async fn delete(&self) -> Result<(), ErrorTypes>
Clear the content of this hash
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Hashmap<T>
impl<T> !RefUnwindSafe for Hashmap<T>
impl<T> Send for Hashmap<T>where
T: Send,
impl<T> Sync for Hashmap<T>where
T: Sync,
impl<T> Unpin for Hashmap<T>where
T: Unpin,
impl<T> !UnwindSafe for Hashmap<T>
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