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
sourceimpl 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
sourceimpl<'a> From<&'a Redirection> for Frame
impl<'a> From<&'a Redirection> for Frame
sourcefn from(redirection: &'a Redirection) -> Self
fn from(redirection: &'a Redirection) -> Self
Converts to this type from the input type.
sourceimpl From<Redirection> for Frame
impl From<Redirection> for Frame
sourcefn from(redirection: Redirection) -> Self
fn from(redirection: Redirection) -> Self
Converts to this type from the input type.
impl Eq for Frame
impl StructuralEq for Frame
impl StructuralPartialEq for Frame
Auto Trait Implementations
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnwindSafe for Frame
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more