pub enum Resp3Value {
Show 15 variants
SimpleString(String),
SimpleError(String),
Number(i64),
BlobString(String),
Array(Vec<Resp3Value>),
Null,
Boolean(bool),
Double(f64),
BigNumber(String),
BlobError(String),
VerbatimString {
encoding: String,
data: String,
},
Map(HashMap<String, Resp3Value>),
Set(HashSet<Resp3Value>),
Attribute {
attrs: HashMap<String, Resp3Value>,
data: Box<Resp3Value>,
},
Push(Vec<Resp3Value>),
}Expand description
RESP3 protocol data types
Variants§
SimpleString(String)
Simple string: +OK\r\n
SimpleError(String)
Simple error: -ERR message\r\n
Number(i64)
Number (integer): :123\r\n
BlobString(String)
Blob string: $5\r\nhello\r\n
Array(Vec<Resp3Value>)
Array: *3\r\n$3\r\nfoo\r\n$3\r\nbar\r\n$3\r\nbaz\r\n
Null
Null: _\r\n
Boolean(bool)
Boolean: #t\r\n or #f\r\n
Double(f64)
Double: ,1.23\r\n
BigNumber(String)
Big number: (3492890328409238509324850943850943825024385\r\n
BlobError(String)
Blob error: !21\r\nSYNTAX invalid syntax\r\n
VerbatimString
Verbatim string: =15\r\ntxt:Some string\r\n
Map(HashMap<String, Resp3Value>)
Map: %2\r\n+first\r\n:1\r\n+second\r\n:2\r\n
Set(HashSet<Resp3Value>)
Set: ~3\r\n+orange\r\n+apple\r\n+one\r\n
Attribute
Attribute: |1\r\n+ttl\r\n:3600\r\n+key\r\n+value\r\n
Fields
attrs: HashMap<String, Resp3Value>The attribute key-value pairs
data: Box<Resp3Value>The actual data with attributes attached
Push(Vec<Resp3Value>)
Push: >4\r\n+pubsub\r\n+message\r\n+channel\r\n+hello\r\n
Implementations§
Source§impl Resp3Value
impl Resp3Value
Sourcepub fn as_string(&self) -> RedisResult<String>
pub fn as_string(&self) -> RedisResult<String>
Convert to a string if possible
§Errors
Returns an error if the value cannot be converted to a string.
Sourcepub fn as_int(&self) -> RedisResult<i64>
pub fn as_int(&self) -> RedisResult<i64>
Convert to an integer if possible
§Errors
Returns an error if the value cannot be converted to an integer.
Sourcepub fn as_float(&self) -> RedisResult<f64>
pub fn as_float(&self) -> RedisResult<f64>
Convert to a float if possible
§Errors
Returns an error if the value cannot be converted to a float.
Sourcepub fn as_bool(&self) -> RedisResult<bool>
pub fn as_bool(&self) -> RedisResult<bool>
Convert to a boolean if possible
§Errors
Returns an error if the value cannot be converted to a boolean.
Trait Implementations§
Source§impl Clone for Resp3Value
impl Clone for Resp3Value
Source§fn clone(&self) -> Resp3Value
fn clone(&self) -> Resp3Value
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Resp3Value
impl Debug for Resp3Value
Source§impl From<Resp3Value> for RespValue
Convert RESP3 value to RESP2 value for backward compatibility
impl From<Resp3Value> for RespValue
Convert RESP3 value to RESP2 value for backward compatibility
Source§fn from(value: Resp3Value) -> Self
fn from(value: Resp3Value) -> Self
Source§impl From<RespValue> for Resp3Value
Convert RESP2 value to RESP3 value
impl From<RespValue> for Resp3Value
Convert RESP2 value to RESP3 value