[−][src]Trait mouscache::FromValue
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) -> Result<Self, RedisError>
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]) -> Result<Vec<Self>, RedisError>
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.
Implementations on Foreign Types
impl FromRedisValue for u64
[src]
fn from_redis_value(v: &Value) -> Result<u64, RedisError>
[src]
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
[src]
impl FromRedisValue for bool
[src]
fn from_redis_value(v: &Value) -> Result<bool, RedisError>
[src]
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
[src]
impl FromRedisValue for isize
[src]
fn from_redis_value(v: &Value) -> Result<isize, RedisError>
[src]
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
[src]
impl<T> FromRedisValue for Vec<T> where
T: FromRedisValue,
[src]
T: FromRedisValue,
fn from_redis_value(v: &Value) -> Result<Vec<T>, RedisError>
[src]
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
[src]
impl FromRedisValue for f32
[src]
fn from_redis_value(v: &Value) -> Result<f32, RedisError>
[src]
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
[src]
impl FromRedisValue for i8
[src]
fn from_redis_value(v: &Value) -> Result<i8, RedisError>
[src]
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
[src]
impl<K, V, S> FromRedisValue for HashMap<K, V, S> where
K: FromRedisValue + Eq + Hash,
S: Default + BuildHasher,
V: FromRedisValue,
[src]
K: FromRedisValue + Eq + Hash,
S: Default + BuildHasher,
V: FromRedisValue,
fn from_redis_value(v: &Value) -> Result<HashMap<K, V, S>, RedisError>
[src]
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
[src]
impl FromRedisValue for u8
[src]
fn from_redis_value(v: &Value) -> Result<u8, RedisError>
[src]
fn from_byte_vec(vec: &[u8]) -> Option<Vec<u8>>
[src]
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
[src]
impl FromRedisValue for i64
[src]
fn from_redis_value(v: &Value) -> Result<i64, RedisError>
[src]
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
[src]
impl FromRedisValue for usize
[src]
fn from_redis_value(v: &Value) -> Result<usize, RedisError>
[src]
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
[src]
impl<T, S> FromRedisValue for HashSet<T, S> where
S: Default + BuildHasher,
T: FromRedisValue + Eq + Hash,
[src]
S: Default + BuildHasher,
T: FromRedisValue + Eq + Hash,
fn from_redis_value(v: &Value) -> Result<HashSet<T, S>, RedisError>
[src]
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
[src]
impl FromRedisValue for f64
[src]
fn from_redis_value(v: &Value) -> Result<f64, RedisError>
[src]
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
[src]
impl<T> FromRedisValue for BTreeSet<T> where
T: FromRedisValue + Eq + Hash + Ord,
[src]
T: FromRedisValue + Eq + Hash + Ord,
fn from_redis_value(v: &Value) -> Result<BTreeSet<T>, RedisError>
[src]
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
[src]
impl FromRedisValue for String
[src]
fn from_redis_value(v: &Value) -> Result<String, RedisError>
[src]
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
[src]
impl FromRedisValue for u16
[src]
fn from_redis_value(v: &Value) -> Result<u16, RedisError>
[src]
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
[src]
impl FromRedisValue for i32
[src]
fn from_redis_value(v: &Value) -> Result<i32, RedisError>
[src]
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
[src]
impl FromRedisValue for InfoDict
[src]
fn from_redis_value(v: &Value) -> Result<InfoDict, RedisError>
[src]
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
[src]
impl<T> FromRedisValue for Option<T> where
T: FromRedisValue,
[src]
T: FromRedisValue,
fn from_redis_value(v: &Value) -> Result<Option<T>, RedisError>
[src]
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
[src]
impl FromRedisValue for i16
[src]
fn from_redis_value(v: &Value) -> Result<i16, RedisError>
[src]
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
[src]
impl FromRedisValue for ()
[src]
fn from_redis_value(_v: &Value) -> Result<(), RedisError>
[src]
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
[src]
impl FromRedisValue for u32
[src]
fn from_redis_value(v: &Value) -> Result<u32, RedisError>
[src]
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
[src]
impl<K, V> FromRedisValue for BTreeMap<K, V> where
K: FromRedisValue + Eq + Hash + Ord,
V: FromRedisValue,
[src]
K: FromRedisValue + Eq + Hash + Ord,
V: FromRedisValue,