pub enum Frame {
SimpleString(Bytes),
Error(Str),
Integer(i64),
BulkString(Bytes),
Array(Vec<Frame>),
Null,
}
Expand description
An enum representing a Frame of data.
Variants§
SimpleString(Bytes)
A short non binary-safe string.
Error(Str)
A short non binary-safe string representing an error.
Integer(i64)
A signed 64 bit integer.
BulkString(Bytes)
A binary-safe string.
Array(Vec<Frame>)
An array of frames, arbitrarily nested.
Null
A null value.
Implementations§
Source§impl Frame
impl Frame
Sourcepub fn is_normal_pubsub(&self) -> bool
pub fn is_normal_pubsub(&self) -> bool
Whether or not the frame represents a publish-subscribe message, but not a pattern publish-subscribe message.
Sourcepub fn is_pubsub_message(&self) -> bool
pub fn is_pubsub_message(&self) -> bool
Whether or not the frame represents a message on a publish-subscribe channel.
Sourcepub fn is_pattern_pubsub_message(&self) -> bool
pub fn is_pattern_pubsub_message(&self) -> bool
Whether or not the frame represents a message on a publish-subscribe channel matched against a pattern subscription.
Sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
Attempt to read the frame value as a string slice without allocating.
Sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Whether or not the frame is an integer.
Sourcepub fn is_moved_or_ask_error(&self) -> bool
pub fn is_moved_or_ask_error(&self) -> bool
Whether or not the framed is a a Moved or Ask error.
pub fn to_string(&self) -> Option<String>
Sourcepub fn parse_as_pubsub(self) -> Result<(String, String), Self>
pub fn parse_as_pubsub(self) -> Result<(String, String), Self>
Attempt to parse the frame as a publish-subscribe message, returning the (channel, message)
tuple
if successful, or the original frame if the inner data is not a publish-subscribe message.
Sourcepub fn to_redirection(&self) -> Option<Redirection>
pub fn to_redirection(&self) -> Option<Redirection>
Attempt to parse the frame as a cluster redirection.
Sourcepub fn encode_len(&self) -> Result<usize, RedisProtocolError>
pub fn encode_len(&self) -> Result<usize, RedisProtocolError>
Attempt to read the number of bytes needed to encode this frame.
Trait Implementations§
Source§impl<'a> From<&'a Redirection> for Frame
impl<'a> From<&'a Redirection> for Frame
Source§fn from(redirection: &'a Redirection) -> Self
fn from(redirection: &'a Redirection) -> Self
Source§impl From<Redirection> for Frame
impl From<Redirection> for Frame
Source§fn from(redirection: Redirection) -> Self
fn from(redirection: Redirection) -> Self
impl Eq for Frame
impl StructuralPartialEq for Frame
Auto Trait Implementations§
impl !Freeze for Frame
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnwindSafe for Frame
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