pub enum BytesFrame {
SimpleString(Bytes),
Error(Str),
Integer(i64),
BulkString(Bytes),
Array(Vec<BytesFrame>),
Null,
}
Available on crate features
resp2
and bytes
only.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
impl BytesFrame
Sourcepub fn to_owned_frame(&self) -> OwnedFrame
pub fn to_owned_frame(&self) -> OwnedFrame
Copy the contents into a new OwnedFrame.
Sourcepub fn into_resp3(self) -> Resp3BytesFrame
pub fn into_resp3(self) -> Resp3BytesFrame
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
impl Clone for BytesFrame
Source§fn clone(&self) -> BytesFrame
fn clone(&self) -> BytesFrame
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for BytesFrame
impl Debug for BytesFrame
Source§impl Encoder<BytesFrame> for Resp2
Available on crate feature codec
only.
impl Encoder<BytesFrame> for Resp2
Available on crate feature
codec
only.Source§impl<T, const N: usize> FromResp2<BytesFrame> for [T; N]where
T: FromResp2<BytesFrame>,
Available on crate feature convert
only.
impl<T, const N: usize> FromResp2<BytesFrame> for [T; N]where
T: FromResp2<BytesFrame>,
Available on crate feature
convert
only.Source§fn from_frame(value: BytesFrame) -> Result<[T; N], RedisProtocolError>
fn from_frame(value: BytesFrame) -> Result<[T; N], RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl FromResp2<BytesFrame> for ()
Available on crate feature convert
only.
impl FromResp2<BytesFrame> for ()
Available on crate feature
convert
only.Source§fn from_frame(_: BytesFrame) -> Result<Self, RedisProtocolError>
fn from_frame(_: BytesFrame) -> Result<Self, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl FromResp2<BytesFrame> for Bytes
Available on crate feature convert
only.
impl FromResp2<BytesFrame> for Bytes
Available on crate feature
convert
only.Source§fn from_frame(frame: BytesFrame) -> Result<Self, RedisProtocolError>
fn from_frame(frame: BytesFrame) -> Result<Self, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl FromResp2<BytesFrame> for BytesFrame
Available on crate feature convert
only.
impl FromResp2<BytesFrame> for BytesFrame
Available on crate feature
convert
only.Source§fn from_frame(frame: BytesFrame) -> Result<Self, RedisProtocolError>
fn from_frame(frame: BytesFrame) -> Result<Self, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
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.
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>
fn from_frame(frame: BytesFrame) -> Result<Self, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl<V, S> FromResp2<BytesFrame> for HashSet<V, S>
Available on crate feature convert
only.
impl<V, S> FromResp2<BytesFrame> for HashSet<V, S>
Available on crate feature
convert
only.Source§fn from_frame(frame: BytesFrame) -> Result<Self, RedisProtocolError>
fn from_frame(frame: BytesFrame) -> Result<Self, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl<T> FromResp2<BytesFrame> for Option<T>where
T: FromResp2<BytesFrame>,
Available on crate feature convert
only.
impl<T> FromResp2<BytesFrame> for Option<T>where
T: FromResp2<BytesFrame>,
Available on crate feature
convert
only.Source§fn from_frame(frame: BytesFrame) -> Result<Option<T>, RedisProtocolError>
fn from_frame(frame: BytesFrame) -> Result<Option<T>, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl FromResp2<BytesFrame> for Str
Available on crate feature convert
only.
impl FromResp2<BytesFrame> for Str
Available on crate feature
convert
only.Source§fn from_frame(frame: BytesFrame) -> Result<Self, RedisProtocolError>
fn from_frame(frame: BytesFrame) -> Result<Self, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl FromResp2<BytesFrame> for String
Available on crate feature convert
only.
impl FromResp2<BytesFrame> for String
Available on crate feature
convert
only.Source§fn from_frame(frame: BytesFrame) -> Result<Self, RedisProtocolError>
fn from_frame(frame: BytesFrame) -> Result<Self, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl<T> FromResp2<BytesFrame> for Vec<T>where
T: FromResp2<BytesFrame>,
Available on crate feature convert
only.
impl<T> FromResp2<BytesFrame> for Vec<T>where
T: FromResp2<BytesFrame>,
Available on crate feature
convert
only.Source§fn from_frame(frame: BytesFrame) -> Result<Vec<T>, RedisProtocolError>
fn from_frame(frame: BytesFrame) -> Result<Vec<T>, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl FromResp2<BytesFrame> for bool
Available on crate feature convert
only.
impl FromResp2<BytesFrame> for bool
Available on crate feature
convert
only.Source§fn from_frame(frame: BytesFrame) -> Result<Self, RedisProtocolError>
fn from_frame(frame: BytesFrame) -> Result<Self, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl FromResp2<BytesFrame> for f32
Available on crate feature convert
only.
impl FromResp2<BytesFrame> for f32
Available on crate feature
convert
only.Source§fn from_frame(frame: BytesFrame) -> Result<Self, RedisProtocolError>
fn from_frame(frame: BytesFrame) -> Result<Self, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl FromResp2<BytesFrame> for f64
Available on crate feature convert
only.
impl FromResp2<BytesFrame> for f64
Available on crate feature
convert
only.Source§fn from_frame(frame: BytesFrame) -> Result<Self, RedisProtocolError>
fn from_frame(frame: BytesFrame) -> Result<Self, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl FromResp2<BytesFrame> for i128
Available on crate feature convert
only.
impl FromResp2<BytesFrame> for i128
Available on crate feature
convert
only.Source§fn from_frame(value: BytesFrame) -> Result<i128, RedisProtocolError>
fn from_frame(value: BytesFrame) -> Result<i128, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl FromResp2<BytesFrame> for i16
Available on crate feature convert
only.
impl FromResp2<BytesFrame> for i16
Available on crate feature
convert
only.Source§fn from_frame(value: BytesFrame) -> Result<i16, RedisProtocolError>
fn from_frame(value: BytesFrame) -> Result<i16, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl FromResp2<BytesFrame> for i32
Available on crate feature convert
only.
impl FromResp2<BytesFrame> for i32
Available on crate feature
convert
only.Source§fn from_frame(value: BytesFrame) -> Result<i32, RedisProtocolError>
fn from_frame(value: BytesFrame) -> Result<i32, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl FromResp2<BytesFrame> for i64
Available on crate feature convert
only.
impl FromResp2<BytesFrame> for i64
Available on crate feature
convert
only.Source§fn from_frame(value: BytesFrame) -> Result<i64, RedisProtocolError>
fn from_frame(value: BytesFrame) -> Result<i64, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl FromResp2<BytesFrame> for i8
Available on crate feature convert
only.
impl FromResp2<BytesFrame> for i8
Available on crate feature
convert
only.Source§fn from_frame(value: BytesFrame) -> Result<i8, RedisProtocolError>
fn from_frame(value: BytesFrame) -> Result<i8, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl FromResp2<BytesFrame> for isize
Available on crate feature convert
only.
impl FromResp2<BytesFrame> for isize
Available on crate feature
convert
only.Source§fn from_frame(value: BytesFrame) -> Result<isize, RedisProtocolError>
fn from_frame(value: BytesFrame) -> Result<isize, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl FromResp2<BytesFrame> for u128
Available on crate feature convert
only.
impl FromResp2<BytesFrame> for u128
Available on crate feature
convert
only.Source§fn from_frame(value: BytesFrame) -> Result<u128, RedisProtocolError>
fn from_frame(value: BytesFrame) -> Result<u128, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl FromResp2<BytesFrame> for u16
Available on crate feature convert
only.
impl FromResp2<BytesFrame> for u16
Available on crate feature
convert
only.Source§fn from_frame(value: BytesFrame) -> Result<u16, RedisProtocolError>
fn from_frame(value: BytesFrame) -> Result<u16, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl FromResp2<BytesFrame> for u32
Available on crate feature convert
only.
impl FromResp2<BytesFrame> for u32
Available on crate feature
convert
only.Source§fn from_frame(value: BytesFrame) -> Result<u32, RedisProtocolError>
fn from_frame(value: BytesFrame) -> Result<u32, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl FromResp2<BytesFrame> for u64
Available on crate feature convert
only.
impl FromResp2<BytesFrame> for u64
Available on crate feature
convert
only.Source§fn from_frame(value: BytesFrame) -> Result<u64, RedisProtocolError>
fn from_frame(value: BytesFrame) -> Result<u64, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl FromResp2<BytesFrame> for u8
Available on crate feature convert
only.
impl FromResp2<BytesFrame> for u8
Available on crate feature
convert
only.Source§fn from_frame(frame: BytesFrame) -> Result<Self, RedisProtocolError>
fn from_frame(frame: BytesFrame) -> Result<Self, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl FromResp2<BytesFrame> for usize
Available on crate feature convert
only.
impl FromResp2<BytesFrame> for usize
Available on crate feature
convert
only.Source§fn from_frame(value: BytesFrame) -> Result<usize, RedisProtocolError>
fn from_frame(value: BytesFrame) -> Result<usize, RedisProtocolError>
Convert a frame to the destination type.
Source§fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
fn from_frames(frames: Vec<F>) -> Result<Vec<Self>, RedisProtocolError>
Convert multiple frames to the destination type.
Source§impl Hash for BytesFrame
impl Hash for BytesFrame
Source§impl PartialEq for BytesFrame
impl PartialEq for BytesFrame
Source§impl Resp2Frame for BytesFrame
impl Resp2Frame for BytesFrame
Source§fn encode_len(&self, int_as_bulkstring: bool) -> usize
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
fn take(&mut self) -> BytesFrame
Replace
self
with Null, returning the original value.Source§fn is_normal_pubsub_message(&self) -> bool
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
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
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
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
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
fn is_redirection(&self) -> bool
Whether the frame is a
MOVED
or ASK
redirection.Source§impl<B: Into<Bytes>> TryFrom<(FrameKind, B)> for BytesFrame
impl<B: Into<Bytes>> TryFrom<(FrameKind, B)> for BytesFrame
Source§type Error = RedisProtocolError
type Error = RedisProtocolError
The type returned in the event of a conversion error.
impl Eq for BytesFrame
impl StructuralPartialEq for BytesFrame
Auto Trait Implementations§
impl !Freeze for BytesFrame
impl RefUnwindSafe for BytesFrame
impl Send for BytesFrame
impl Sync for BytesFrame
impl Unpin for BytesFrame
impl UnwindSafe for BytesFrame
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
Mutably borrows from an owned value. Read more
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>
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 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>
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