Skip to content

Commit

Permalink
Derive Clone and add Deref trait to InfoDict (redis-rs#661)
Browse files Browse the repository at this point in the history
  • Loading branch information
danni-m authored and nonirosenfeldredis committed Feb 13, 2023
1 parent b197a50 commit babd90c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion redis/src/types.rs
Expand Up @@ -13,6 +13,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 @@ -578,7 +579,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 @@ -648,6 +649,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 babd90c

Please sign in to comment.