Skip to main content

BytesFrame

Enum BytesFrame 

Source
pub enum BytesFrame {
    SimpleString(Bytes),
    Error(Str),
    Integer(i64),
    BulkString(Bytes),
    Array(Vec<BytesFrame>),
    Null,
}
Available on crate feature bytes only.
Expand description

A RESP2 frame that uses Bytes and Str as the underlying buffer type.

Variants§

§

SimpleString(Bytes)

A RESP2 simple string.

§

Error(Str)

A short string representing an error.

§

Integer(i64)

A signed 64-bit integer.

§

BulkString(Bytes)

A byte array.

§

Array(Vec<BytesFrame>)

An array of frames.

§

Null

A null value.

Implementations§

Source§

impl BytesFrame

Source

pub fn to_owned_frame(&self) -> OwnedFrame

Available on crate feature resp2 only.

Copy the contents into a new OwnedFrame.

Source

pub fn into_resp3(self) -> Resp3BytesFrame

Available on crate feature resp2 only.

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 BytesFrame

Available on crate feature resp2 only.
Source§

fn clone(&self) -> BytesFrame

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for BytesFrame

Available on crate feature resp2 only.
Source§

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

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

impl Encoder<BytesFrame> for Resp2

Available on crate feature codec only.
Source§

type Error = RedisProtocolError

The type of encoding errors. Read more
Source§

fn encode( &mut self, item: Resp2Frame, dst: &mut BytesMut, ) -> Result<(), Self::Error>

Encodes a frame into the buffer provided. Read more
Source§

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

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl FromResp2<BytesFrame> for ()

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl FromResp2<BytesFrame> for Bytes

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl FromResp2<BytesFrame> for BytesFrame

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

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

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

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

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl<T> FromResp2<BytesFrame> for Option<T>

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl FromResp2<BytesFrame> for Str

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl FromResp2<BytesFrame> for String

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl<T> FromResp2<BytesFrame> for Vec<T>

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl FromResp2<BytesFrame> for bool

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl FromResp2<BytesFrame> for f32

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl FromResp2<BytesFrame> for f64

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl FromResp2<BytesFrame> for i128

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl FromResp2<BytesFrame> for i16

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl FromResp2<BytesFrame> for i32

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl FromResp2<BytesFrame> for i64

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl FromResp2<BytesFrame> for i8

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl FromResp2<BytesFrame> for isize

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl FromResp2<BytesFrame> for u128

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl FromResp2<BytesFrame> for u16

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl FromResp2<BytesFrame> for u32

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl FromResp2<BytesFrame> for u64

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl FromResp2<BytesFrame> for u8

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl FromResp2<BytesFrame> for usize

Available on crate feature convert only.
Source§

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

Available on crate feature resp2 only.
Convert a frame to the destination type.
Source§

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

Available on crate feature resp2 only.
Convert multiple frames to the destination type.
Source§

impl Hash for BytesFrame

Available on crate feature resp2 only.
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 BytesFrame

Available on crate feature resp2 only.
Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 BytesFrame

Available on crate feature resp2 only.
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) -> BytesFrame

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<B: Into<Bytes>> TryFrom<(FrameKind, B)> for BytesFrame

Available on crate feature resp2 only.
Source§

type Error = RedisProtocolError

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

fn try_from((kind, buf): (FrameKind, B)) -> Result<Self, RedisProtocolError>

Performs the conversion.
Source§

impl Eq for BytesFrame

Available on crate feature resp2 only.
Source§

impl StructuralPartialEq for BytesFrame

Available on crate feature resp2 only.

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.