Skip to main content

BytesFrame

Enum BytesFrame 

Source
pub enum BytesFrame {
Show 16 variants BlobString { data: Bytes, attributes: Option<BytesAttributes>, }, BlobError { data: Bytes, attributes: Option<BytesAttributes>, }, SimpleString { data: Bytes, attributes: Option<BytesAttributes>, }, SimpleError { data: Str, attributes: Option<BytesAttributes>, }, Boolean { data: bool, attributes: Option<BytesAttributes>, }, Null, Number { data: i64, attributes: Option<BytesAttributes>, }, Double { data: f64, attributes: Option<BytesAttributes>, }, BigNumber { data: Bytes, attributes: Option<BytesAttributes>, }, VerbatimString { data: Bytes, format: VerbatimStringFormat, attributes: Option<BytesAttributes>, }, Array { data: Vec<BytesFrame>, attributes: Option<BytesAttributes>, }, Map { data: FrameMap<BytesFrame, BytesFrame>, attributes: Option<BytesAttributes>, }, Set { data: FrameSet<BytesFrame>, attributes: Option<BytesAttributes>, }, Push { data: Vec<BytesFrame>, attributes: Option<BytesAttributes>, }, Hello { version: RespVersion, auth: Option<(Str, Str)>, setname: Option<Str>, }, ChunkedString(Bytes),
}
Available on crate feature bytes only.
Expand description

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

https://github.com/antirez/RESP3/blob/master/spec.md

Variants§

§

BlobString

A blob of bytes.

Fields

§data: Bytes
§

BlobError

A blob representing an error.

Fields

§data: Bytes
§

SimpleString

A small string.

The internal data type is Bytes in order to support callers that use this interface to parse a MONITOR stream.

Fields

§data: Bytes
§

SimpleError

A small string representing an error.

Fields

§data: Str
§

Boolean

A boolean type.

Fields

§data: bool
§

Null

A null type.

§

Number

A signed 64-bit integer.

Fields

§data: i64
§

Double

A signed 64-bit floating point number.

Fields

§data: f64
§

BigNumber

A large number not representable as a Number or Double.

This library does not attempt to parse this.

Fields

§data: Bytes
§

VerbatimString

A string to be displayed without any escaping or filtering.

§

Array

An array of frames.

Fields

§

Map

An unordered map of key-value pairs.

According to the spec keys can be any other RESP3 data type. However, it doesn’t make sense to implement Hash for certain aggregate types. The can_hash function can be used to detect this.

§

Set

An unordered collection of other frames with a uniqueness constraint.

§

Push

Out-of-band data.

Fields

§

Hello

A special frame type used when first connecting to the server to describe the protocol version and optional credentials.

Fields

§version: RespVersion
§auth: Option<(Str, Str)>
§setname: Option<Str>
§

ChunkedString(Bytes)

One chunk of a streaming blob.

Implementations§

Source§

impl BytesFrame

Source

pub fn to_owned_frame(&self) -> OwnedFrame

Available on crate feature resp3 only.

Copy the frame contents into a new OwnedFrame.

Trait Implementations§

Source§

impl Clone for BytesFrame

Available on crate feature resp3 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 resp3 only.
Source§

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

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

impl Encoder<BytesFrame> for Resp3

Available on crate feature codec only.
Source§

type Error = RedisProtocolError

The type of encoding errors. Read more
Source§

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

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

impl From<bool> for BytesFrame

Available on crate feature resp3 only.
Source§

fn from(value: bool) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for BytesFrame

Available on crate feature resp3 only.
Source§

fn from(value: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for BytesFrame

Available on crate feature resp3 only.
Source§

fn from(value: i64) -> Self

Converts to this type from the input type.
Source§

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

Available on crate feature convert only.
Source§

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

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

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

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

impl FromResp3<BytesFrame> for ()

Available on crate feature convert only.
Source§

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

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

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

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

impl FromResp3<BytesFrame> for Bytes

Available on crate feature convert only.
Source§

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

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

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

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

impl FromResp3<BytesFrame> for BytesFrame

Available on crate feature convert only.
Source§

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

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

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

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

impl<K, V, S> FromResp3<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 resp3 only.
Convert a frame to the destination type.
Source§

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

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

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

Available on crate feature convert only.
Source§

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

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

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

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

impl<T> FromResp3<BytesFrame> for Option<T>

Available on crate feature convert only.
Source§

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

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

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

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

impl FromResp3<BytesFrame> for Str

Available on crate feature convert only.
Source§

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

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

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

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

impl FromResp3<BytesFrame> for String

Available on crate feature convert only.
Source§

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

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

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

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

impl<T> FromResp3<BytesFrame> for Vec<T>

Available on crate feature convert only.
Source§

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

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

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

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

impl FromResp3<BytesFrame> for bool

Available on crate feature convert only.
Source§

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

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

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

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

impl FromResp3<BytesFrame> for f32

Available on crate feature convert only.
Source§

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

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

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

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

impl FromResp3<BytesFrame> for f64

Available on crate feature convert only.
Source§

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

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

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

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

impl FromResp3<BytesFrame> for i128

Available on crate feature convert only.
Source§

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

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

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

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

impl FromResp3<BytesFrame> for i16

Available on crate feature convert only.
Source§

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

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

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

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

impl FromResp3<BytesFrame> for i32

Available on crate feature convert only.
Source§

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

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

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

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

impl FromResp3<BytesFrame> for i64

Available on crate feature convert only.
Source§

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

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

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

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

impl FromResp3<BytesFrame> for i8

Available on crate feature convert only.
Source§

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

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

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

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

impl FromResp3<BytesFrame> for isize

Available on crate feature convert only.
Source§

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

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

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

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

impl FromResp3<BytesFrame> for u128

Available on crate feature convert only.
Source§

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

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

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

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

impl FromResp3<BytesFrame> for u16

Available on crate feature convert only.
Source§

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

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

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

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

impl FromResp3<BytesFrame> for u32

Available on crate feature convert only.
Source§

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

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

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

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

impl FromResp3<BytesFrame> for u64

Available on crate feature convert only.
Source§

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

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

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

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

impl FromResp3<BytesFrame> for u8

Available on crate feature convert only.
Source§

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

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

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

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

impl FromResp3<BytesFrame> for usize

Available on crate feature convert only.
Source§

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

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

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

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

impl Hash for BytesFrame

Available on crate feature resp3 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 resp3 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 Resp3Frame for BytesFrame

Available on crate feature resp3 only.
Source§

fn add_attributes( &mut self, attributes: Self::Attributes, ) -> Result<(), RedisProtocolError>

Attempt to add attributes to the frame, extending the existing attributes if needed.

Source§

type Attributes = HashMap<BytesFrame, BytesFrame>

Source§

fn from_buffer( target: FrameKind, buf: impl IntoIterator<Item = Self>, attributes: Option<Self::Attributes>, ) -> Result<Self, RedisProtocolError>

Create the target aggregate type based on a buffered set of chunked frames.
Source§

fn attributes(&self) -> Option<&Self::Attributes>

Read the attributes attached to the frame.
Source§

fn take_attributes(&mut self) -> Option<Self::Attributes>

Take the attributes off this frame.
Source§

fn attributes_mut(&mut self) -> Option<&mut Self::Attributes>

Read a mutable reference to any attributes attached to the frame.
Source§

fn new_empty() -> Self

Create a new empty frame with attribute support.
Source§

fn new_end_stream() -> Self

Create a new frame that terminates a stream.
Source§

fn len(&self) -> usize

A context-aware length function that returns the length of the inner frame contents. Read more
Source§

fn take(&mut self) -> BytesFrame

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

fn kind(&self) -> FrameKind

Read the associated FrameKind.
Source§

fn is_end_stream_frame(&self) -> bool

Whether the frame is an empty chunked string, signifying the end of a chunked string stream.
Source§

fn verbatim_string_format(&self) -> Option<&VerbatimStringFormat>

If the frame is a verbatim string then read the associated format.
Source§

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

Read the frame as a string slice if it can be parsed as a UTF-8 string without allocating.
Source§

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

Attempt to convert the frame to a bool.
Source§

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

Read the frame as a String if it can be parsed as a UTF-8 string.
Source§

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

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

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

Read the number of bytes necessary to represent the frame and any associated attributes.
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: FromResp3<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 resp3 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, Self::Error>

Performs the conversion.
Source§

impl Eq for BytesFrame

Available on crate feature resp3 only.
Source§

impl StructuralPartialEq for BytesFrame

Available on crate feature resp3 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.