pub enum Value {
Simple(String),
Error(String),
Integer(i64),
Bulk(Vec<u8>),
Nil,
Array(Vec<Value>),
}Expand description
One decoded RESP value.
Variants§
Simple(String)
+OK — a status reply.
Error(String)
-ERR ... — an error reply. Carried as a value rather than a Rust error
so the decoder stays total and the caller decides what is fatal.
Integer(i64)
:42
Bulk(Vec<u8>)
$5\r\nhello — arbitrary bytes, not necessarily UTF-8.
Nil
$-1 or *-1 — the absence of a value, which is how Redis says
“no such key”.
Array(Vec<Value>)
*2\r\n...
Implementations§
Source§impl Value
impl Value
pub fn as_bytes(&self) -> Option<&[u8]>
Sourcepub fn as_i64(&self) -> Option<i64>
pub fn as_i64(&self) -> Option<i64>
An integer reply, or a bulk string that happens to hold digits — Redis
answers TTL with the first and GET on a counter with the second.
pub fn is_nil(&self) -> bool
Sourcepub fn into_result(self) -> Result<Value>
pub fn into_result(self) -> Result<Value>
Convert an error reply into a Rust error, leaving anything else alone.
Trait Implementations§
impl Eq for Value
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more