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.
Trait Implementations§
impl Eq for Request
impl StructuralPartialEq for Request
Auto Trait Implementations§
impl Freeze for Request
impl !RefUnwindSafe for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl !UnwindSafe for Request
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more