Enum OwnedFrame

Source
pub enum OwnedFrame {
    SimpleString(Vec<u8>),
    Error(String),
    Integer(i64),
    BulkString(Vec<u8>),
    Array(Vec<OwnedFrame>),
    Null,
}
Available on crate feature resp2 only.
Expand description

A RESP2 frame.

Variants§

§

SimpleString(Vec<u8>)

A RESP2 simple string.

§

Error(String)

A short string representing an error.

§

Integer(i64)

A signed 64-bit integer.

§

BulkString(Vec<u8>)

A byte array.

§

Array(Vec<OwnedFrame>)

An array of frames,

§

Null

A null value.

Implementations§

Source§

impl OwnedFrame

Source

pub fn into_bytes_frame(self) -> BytesFrame

Available on crate feature bytes only.

Move the frame contents into a new BytesFrame.

Source

pub fn into_resp3(self) -> Resp3OwnedFrame

Convert the frame to RESP3.

For the most part RESP3 is a superset of RESP2, but there is one notable difference with publish-subscribe messages - in RESP3 pubsub arrays have an additional prefix frame with the SimpleString value “pubsub”. This function will add this frame.

Trait Implementations§

Source§

impl Clone for OwnedFrame

Source§

fn clone(&self) -> OwnedFrame

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for OwnedFrame

Source§

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

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

impl<T, const N: usize> FromResp2<OwnedFrame> for [T; N]

Available on crate feature convert only.
Source§

fn from_frame(value: OwnedFrame) -> Result<[T; N], RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl FromResp2<OwnedFrame> for ()

Available on crate feature convert only.
Source§

fn from_frame(_: OwnedFrame) -> Result<Self, RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl<K, V, S> FromResp2<OwnedFrame> for HashMap<K, V, S>

Available on crate feature convert only.
Source§

fn from_frame(frame: OwnedFrame) -> Result<Self, RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl<V, S> FromResp2<OwnedFrame> for HashSet<V, S>

Available on crate feature convert only.
Source§

fn from_frame(frame: OwnedFrame) -> Result<Self, RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl<T> FromResp2<OwnedFrame> for Option<T>

Available on crate feature convert only.
Source§

fn from_frame(frame: OwnedFrame) -> Result<Option<T>, RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl FromResp2<OwnedFrame> for OwnedFrame

Available on crate feature convert only.
Source§

fn from_frame(frame: OwnedFrame) -> Result<Self, RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl FromResp2<OwnedFrame> for String

Available on crate feature convert only.
Source§

fn from_frame(frame: OwnedFrame) -> Result<Self, RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl<T> FromResp2<OwnedFrame> for Vec<T>

Available on crate feature convert only.
Source§

fn from_frame(frame: OwnedFrame) -> Result<Vec<T>, RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl FromResp2<OwnedFrame> for bool

Available on crate feature convert only.
Source§

fn from_frame(frame: OwnedFrame) -> Result<Self, RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl FromResp2<OwnedFrame> for f32

Available on crate feature convert only.
Source§

fn from_frame(frame: OwnedFrame) -> Result<Self, RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl FromResp2<OwnedFrame> for f64

Available on crate feature convert only.
Source§

fn from_frame(frame: OwnedFrame) -> Result<Self, RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl FromResp2<OwnedFrame> for i128

Available on crate feature convert only.
Source§

fn from_frame(value: OwnedFrame) -> Result<i128, RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl FromResp2<OwnedFrame> for i16

Available on crate feature convert only.
Source§

fn from_frame(value: OwnedFrame) -> Result<i16, RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl FromResp2<OwnedFrame> for i32

Available on crate feature convert only.
Source§

fn from_frame(value: OwnedFrame) -> Result<i32, RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl FromResp2<OwnedFrame> for i64

Available on crate feature convert only.
Source§

fn from_frame(value: OwnedFrame) -> Result<i64, RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl FromResp2<OwnedFrame> for i8

Available on crate feature convert only.
Source§

fn from_frame(value: OwnedFrame) -> Result<i8, RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl FromResp2<OwnedFrame> for isize

Available on crate feature convert only.
Source§

fn from_frame(value: OwnedFrame) -> Result<isize, RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl FromResp2<OwnedFrame> for u128

Available on crate feature convert only.
Source§

fn from_frame(value: OwnedFrame) -> Result<u128, RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl FromResp2<OwnedFrame> for u16

Available on crate feature convert only.
Source§

fn from_frame(value: OwnedFrame) -> Result<u16, RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl FromResp2<OwnedFrame> for u32

Available on crate feature convert only.
Source§

fn from_frame(value: OwnedFrame) -> Result<u32, RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl FromResp2<OwnedFrame> for u64

Available on crate feature convert only.
Source§

fn from_frame(value: OwnedFrame) -> Result<u64, RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl FromResp2<OwnedFrame> for u8

Available on crate feature convert only.
Source§

fn from_frame(frame: OwnedFrame) -> Result<Self, RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl FromResp2<OwnedFrame> for usize

Available on crate feature convert only.
Source§

fn from_frame(value: OwnedFrame) -> Result<usize, RedisProtocolError>

Convert a frame to the destination type.
Source§

fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>

Convert multiple frames to the destination type.
Source§

impl Hash for OwnedFrame

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for OwnedFrame

Source§

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

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

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 Resp2Frame for OwnedFrame

Source§

fn encode_len(&self, int_as_bulkstring: bool) -> usize

Read the number of bytes needed to encode this frame.
Source§

fn take(&mut self) -> OwnedFrame

Replace self with Null, returning the original value.
Source§

fn kind(&self) -> FrameKind

Read the FrameKind value for this frame.
Source§

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

Attempt to read the frame value as a string slice.
Source§

fn as_bool(&self) -> Option<bool>

Convert the value to a boolean.
Source§

fn as_bytes(&self) -> Option<&[u8]>

Attempt to read the frame value as a byte slice.
Source§

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

Copy and read the inner value as a string, if possible.
Source§

fn is_normal_pubsub_message(&self) -> bool

Whether the frame is a message from a subscribe call.
Source§

fn is_pattern_pubsub_message(&self) -> bool

Whether the frame is a message from a psubscribe call.
Source§

fn is_shard_pubsub_message(&self) -> bool

Whether the frame is a message from a ssubscribe call.
Source§

fn is_single_element_vec(&self) -> bool

Available on crate feature convert only.
Whether frame is a bulk array with a single element.
Source§

fn pop_or_take(self) -> Self

Available on crate feature convert only.
Pop an element from the inner array or return the original frame. Read more
Source§

fn is_redirection(&self) -> bool

Whether the frame is a MOVED or ASK redirection.
Source§

fn as_f64(&self) -> Option<f64>

Convert the frame to a double.
Source§

fn convert<T>(self) -> Result<T, RedisProtocolError>
where Self: Sized, T: FromResp2<Self>,

Available on crate feature convert only.
Convert the frame to another type.
Source§

impl Eq for OwnedFrame

Source§

impl StructuralPartialEq for OwnedFrame

Auto Trait Implementations§

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.