Skip to content

Commit

Permalink
add derive Clone and Deref<Target=HashMap<String, Value>> trait to In…
Browse files Browse the repository at this point in the history
…foDict
  • Loading branch information
danni-m committed Sep 7, 2022
1 parent 470d7c5 commit 960d878
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion redis/src/types.rs
Expand Up @@ -12,6 +12,7 @@ use std::string::FromUtf8Error;
pub(crate) use ahash::{AHashMap as HashMap, AHashSet as HashSet};
#[cfg(not(feature = "ahash"))]
pub(crate) use std::collections::{HashMap, HashSet};
use std::ops::Deref;

macro_rules! invalid_type_error {
($v:expr, $det:expr) => {{
Expand Down Expand Up @@ -548,7 +549,7 @@ pub type RedisResult<T> = Result<T, RedisError>;
pub type RedisFuture<'a, T> = futures_util::future::BoxFuture<'a, RedisResult<T>>;

/// An info dictionary type.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct InfoDict {
map: HashMap<String, Value>,
}
Expand Down Expand Up @@ -618,6 +619,14 @@ impl InfoDict {
}
}

impl Deref for InfoDict {
type Target = HashMap<String, Value>;

fn deref(&self) -> &Self::Target {
&self.map
}
}

/// Abstraction trait for redis command abstractions.
pub trait RedisWrite {
/// Accepts a serialized redis command.
Expand Down

0 comments on commit 960d878

Please sign in to comment.