Trait redis::FromRedisValue
[−]
[src]
pub trait FromRedisValue: Sized {
fn from_redis_value(v: &Value) -> RedisResult<Self>;
fn from_redis_values(items: &[Value]) -> RedisResult<Vec<Self>> { ... }
}This trait is used to convert a redis value into a more appropriate
type. While a redis Value can represent any response that comes
back from the redis server, usually you want to map this into something
that works better in rust. For instance you might want to convert the
return value into a String or an integer.
This trait is well supported throughout the library and you can implement it for your own types if you want.
In addition to what you can see from the docs, this is also implemented
for tuples up to size 12 and for Vec
Required Methods
fn from_redis_value(v: &Value) -> RedisResult<Self>
Given a redis Value this attempts to convert it into the given
destination type. If that fails because it's not compatible an
appropriate error is generated.
Provided Methods
fn from_redis_values(items: &[Value]) -> RedisResult<Vec<Self>>
Similar to from_redis_value but constructs a vector of objects
from another vector of values. This primarily exists internally
to customize the behavior for vectors of tuples.
Implementors
impl FromRedisValue for u8impl FromRedisValue for i8impl FromRedisValue for i16impl FromRedisValue for u16impl FromRedisValue for i32impl FromRedisValue for u32impl FromRedisValue for i64impl FromRedisValue for u64impl FromRedisValue for f32impl FromRedisValue for f64impl FromRedisValue for isizeimpl FromRedisValue for usizeimpl FromRedisValue for boolimpl FromRedisValue for Stringimpl<T: FromRedisValue> FromRedisValue for Vec<T>impl<K: FromRedisValue + Eq + Hash, V: FromRedisValue> FromRedisValue for HashMap<K, V>impl<T: FromRedisValue + Eq + Hash> FromRedisValue for HashSet<T>impl FromRedisValue for Valueimpl FromRedisValue for ()impl FromRedisValue for InfoDictimpl FromRedisValue for Jsonimpl<T: FromRedisValue> FromRedisValue for Option<T>