Enum Frame

Source
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

Source

pub fn take(&mut self) -> Frame

Replace self with Null, returning the original value.

Source

pub fn is_error(&self) -> bool

Whether or not the frame is an error.

Source

pub fn is_normal_pubsub(&self) -> bool

Whether or not the frame represents a publish-subscribe message, but not a pattern publish-subscribe message.

Source

pub fn is_pubsub_message(&self) -> bool

Whether or not the frame represents a message on a publish-subscribe channel.

Source

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.

Source

pub fn kind(&self) -> FrameKind

Read the FrameKind value for this frame.

Source

pub fn as_str(&self) -> Option<&str>

Attempt to read the frame value as a string slice without allocating.

Source

pub fn is_string(&self) -> bool

Whether or not the frame is a simple string or bulk string.

Source

pub fn is_null(&self) -> bool

Whether or not the frame is Null.

Source

pub fn is_array(&self) -> bool

Whether or not the frame is an array of frames.

Source

pub fn is_integer(&self) -> bool

Whether or not the frame is an integer.

Source

pub fn is_moved_or_ask_error(&self) -> bool

Whether or not the framed is a a Moved or Ask error.

Source

pub fn to_string(&self) -> Option<String>

Source

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.

Source

pub fn to_redirection(&self) -> Option<Redirection>

Attempt to parse the frame as a cluster redirection.

Source

pub fn encode_len(&self) -> Result<usize, RedisProtocolError>

Attempt to read the number of bytes needed to encode this frame.

Trait Implementations§

Source§

impl Clone for Frame

Source§

fn clone(&self) -> Frame

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Frame

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> From<&'a Redirection> for Frame

Source§

fn from(redirection: &'a Redirection) -> Self

Converts to this type from the input type.
Source§

impl From<Redirection> for Frame

Source§

fn from(redirection: Redirection) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Frame

Source§

fn eq(&self, other: &Frame) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Frame

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.