Trait reool::FromRedisValue[][src]

pub trait FromRedisValue {
    pub fn from_redis_value(v: &Value) -> Result<Self, RedisError>;

    pub fn from_redis_values(
        items: &[Value]
    ) -> Result<Vec<Self, Global>, RedisError> { ... } }

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

pub fn from_redis_value(v: &Value) -> Result<Self, RedisError>[src]

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.

Loading content...

Provided methods

pub fn from_redis_values(
    items: &[Value]
) -> Result<Vec<Self, Global>, RedisError>
[src]

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.

Loading content...

Implementations on Foreign Types

impl FromRedisValue for StreamPendingCountReply[src]

impl<T, S> FromRedisValue for HashSet<T, S> where
    T: FromRedisValue + Eq + Hash,
    S: BuildHasher + Default
[src]

impl FromRedisValue for RadiusSearchResult[src]

impl FromRedisValue for bool[src]

impl FromRedisValue for ()[src]

impl<T> FromRedisValue for Vec<T, Global> where
    T: FromRedisValue
[src]

impl FromRedisValue for StreamInfoConsumersReply[src]

impl FromRedisValue for i64[src]

impl FromRedisValue for i32[src]

impl FromRedisValue for StreamPendingReply[src]

impl FromRedisValue for i16[src]

impl<K, V> FromRedisValue for BTreeMap<K, V> where
    K: FromRedisValue + Eq + Hash + Ord,
    V: FromRedisValue
[src]

impl FromRedisValue for StreamInfoGroupsReply[src]

impl<T> FromRedisValue for Coord<T> where
    T: FromRedisValue
[src]

impl FromRedisValue for AclInfo[src]

impl FromRedisValue for String[src]

impl FromRedisValue for f64[src]

impl FromRedisValue for u64[src]

impl FromRedisValue for i8[src]

impl FromRedisValue for u128[src]

impl FromRedisValue for i128[src]

impl FromRedisValue for InfoDict[src]

impl FromRedisValue for StreamReadReply[src]

impl FromRedisValue for StreamRangeReply[src]

impl FromRedisValue for u16[src]

impl FromRedisValue for f32[src]

impl<T> FromRedisValue for BTreeSet<T> where
    T: FromRedisValue + Eq + Hash + Ord
[src]

impl FromRedisValue for usize[src]

impl<K, V, S> FromRedisValue for HashMap<K, V, S> where
    S: BuildHasher + Default,
    K: FromRedisValue + Eq + Hash,
    V: FromRedisValue
[src]

impl<T> FromRedisValue for Option<T> where
    T: FromRedisValue
[src]

impl FromRedisValue for isize[src]

impl FromRedisValue for StreamClaimReply[src]

impl FromRedisValue for u8[src]

impl FromRedisValue for StreamInfoStreamReply[src]

impl FromRedisValue for u32[src]

Loading content...

Implementors

Loading content...