pub struct InfoDict { /* private fields */ }
Expand description
An info dictionary type.
Implementations
sourceimpl InfoDict
impl InfoDict
This type provides convenient access to key/value data returned by
the “INFO” command. It acts like a regular mapping but also has
a convenience method get
which can return data in the appropriate
type.
For instance this can be used to query the server for the role it’s in (master, slave) etc:
let info : redis::InfoDict = redis::cmd("INFO").query(&mut con)?;
let role : Option<String> = info.get("role");
sourcepub fn new(kvpairs: &str) -> InfoDict
pub fn new(kvpairs: &str) -> InfoDict
Creates a new info dictionary from a string in the response of
the INFO command. Each line is a key, value pair with the
key and value separated by a colon (:
). Lines starting with a
hash (#
) are ignored.
sourcepub fn get<T: FromRedisValue>(&self, key: &str) -> Option<T>
pub fn get<T: FromRedisValue>(&self, key: &str) -> Option<T>
Fetches a value by key and converts it into the given type.
Typical types are String
, bool
and integer types.
sourcepub fn contains_key(&self, key: &&str) -> bool
pub fn contains_key(&self, key: &&str) -> bool
Checks if a key is contained in the info dicf.
Trait Implementations
sourceimpl FromRedisValue for InfoDict
impl FromRedisValue for InfoDict
sourcefn from_redis_value(v: &Value) -> RedisResult<InfoDict>
fn from_redis_value(v: &Value) -> RedisResult<InfoDict>
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. Read more
sourcefn from_redis_values(items: &[Value]) -> RedisResult<Vec<Self>>
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. Read more
Auto Trait Implementations
impl RefUnwindSafe for InfoDict
impl Send for InfoDict
impl Sync for InfoDict
impl Unpin for InfoDict
impl UnwindSafe for InfoDict
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more