pub enum Request {
Array(Vec<Request>),
BulkString(BulkString),
BulkStatic(&'static [u8]),
BulkInteger(i64),
String(ByteString),
Integer(i64),
}
Expand description
A single RESP value, this owns the data that is to-be written to Redis.
It is cloneable to allow multiple copies to be delivered in certain circumstances, e.g. multiple subscribers to the same topic.
Variants§
Array(Vec<Request>)
Zero, one or more other Reqeests
s.
BulkString(BulkString)
A bulk string. In Redis terminology a string is a byte-array, so this is stored as a
vector of u8
s to allow clients to interpret the bytes as appropriate.
BulkStatic(&'static [u8])
A bulk string. In Redis terminology a string is a byte-array, so this is stored as a
vector of u8
s to allow clients to interpret the bytes as appropriate.
BulkInteger(i64)
Convert integer to string representation.
String(ByteString)
A valid utf-8 string
Integer(i64)
Redis documentation defines an integer as being a signed 64-bit integer: https://redis.io/topics/protocol#resp-integers
Implementations§
Source§impl Request
impl Request
Sourcepub fn from_static(data: &'static str) -> Self
pub fn from_static(data: &'static str) -> Self
Create request from static str
Sourcepub fn from_bstatic(data: &'static [u8]) -> Self
pub fn from_bstatic(data: &'static [u8]) -> Self
Create request from static str
Sourcepub fn add<T>(self, other: T) -> Self
pub fn add<T>(self, other: T) -> Self
Convenience function for building dynamic Redis commands with variable numbers of arguments, e.g. RPUSH
Self get converted to array if it is not an array.
Sourcepub fn extend<T>(self, other: impl IntoIterator<Item = T>) -> Self
pub fn extend<T>(self, other: impl IntoIterator<Item = T>) -> Self
Convenience function for building dynamic Redis commands with variable numbers of arguments, e.g. RPUSH
Self get converted to array if it is not an array.