Enum fred::types::Resp3Frame

pub enum Resp3Frame {
Show 16 variants BlobString { data: Bytes, attributes: Option<HashMap<BytesFrame, BytesFrame>>, }, BlobError { data: Bytes, attributes: Option<HashMap<BytesFrame, BytesFrame>>, }, SimpleString { data: Bytes, attributes: Option<HashMap<BytesFrame, BytesFrame>>, }, SimpleError { data: StrInner<Bytes>, attributes: Option<HashMap<BytesFrame, BytesFrame>>, }, Boolean { data: bool, attributes: Option<HashMap<BytesFrame, BytesFrame>>, }, Null, Number { data: i64, attributes: Option<HashMap<BytesFrame, BytesFrame>>, }, Double { data: f64, attributes: Option<HashMap<BytesFrame, BytesFrame>>, }, BigNumber { data: Bytes, attributes: Option<HashMap<BytesFrame, BytesFrame>>, }, VerbatimString { data: Bytes, format: VerbatimStringFormat, attributes: Option<HashMap<BytesFrame, BytesFrame>>, }, Array { data: Vec<BytesFrame>, attributes: Option<HashMap<BytesFrame, BytesFrame>>, }, Map { data: HashMap<BytesFrame, BytesFrame>, attributes: Option<HashMap<BytesFrame, BytesFrame>>, }, Set { data: HashSet<BytesFrame>, attributes: Option<HashMap<BytesFrame, BytesFrame>>, }, Push { data: Vec<BytesFrame>, attributes: Option<HashMap<BytesFrame, BytesFrame>>, }, Hello { version: RespVersion, auth: Option<(StrInner<Bytes>, StrInner<Bytes>)>, setname: Option<StrInner<Bytes>>, }, ChunkedString(Bytes),
}
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: StrInner<Bytes>
§

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.

Fields

§data: Bytes
§format: VerbatimStringFormat
§

Array

An array of frames.

§

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.

§

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<(StrInner<Bytes>, StrInner<Bytes>)>
§setname: Option<StrInner<Bytes>>
§

ChunkedString(Bytes)

One chunk of a streaming blob.

Implementations§

§

impl BytesFrame

pub fn to_owned_frame(&self) -> OwnedFrame

Copy the frame contents into a new [OwnedFrame].

Trait Implementations§

§

impl Clone for BytesFrame

§

fn clone(&self) -> BytesFrame

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
§

impl Debug for BytesFrame

§

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

Formats the value using the given formatter. Read more
§

impl From<bool> for BytesFrame

§

fn from(value: bool) -> BytesFrame

Converts to this type from the input type.
§

impl From<f64> for BytesFrame

§

fn from(value: f64) -> BytesFrame

Converts to this type from the input type.
§

impl From<i64> for BytesFrame

§

fn from(value: i64) -> BytesFrame

Converts to this type from the input type.
§

impl Hash for BytesFrame

§

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

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
§

impl PartialEq for BytesFrame

§

fn eq(&self, other: &BytesFrame) -> 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.
§

impl Resp3Frame for BytesFrame

§

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

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

§

type Attributes = HashMap<BytesFrame, BytesFrame>

§

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

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

fn attributes(&self) -> Option<&<BytesFrame as Resp3Frame>::Attributes>

Read the attributes attached to the frame.
§

fn take_attributes(&mut self) -> Option<<BytesFrame as Resp3Frame>::Attributes>

Take the attributes off this frame.
§

fn attributes_mut( &mut self, ) -> Option<&mut <BytesFrame as Resp3Frame>::Attributes>

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

fn new_empty() -> BytesFrame

Create a new empty frame with attribute support.
§

fn new_end_stream() -> BytesFrame

Create a new frame that terminates a stream.
§

fn len(&self) -> usize

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

fn take(&mut self) -> BytesFrame

Replace self with Null, returning the original value.
§

fn kind(&self) -> FrameKind

Read the associated FrameKind.
§

fn is_end_stream_frame(&self) -> bool

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

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

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

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.
§

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

Attempt to convert the frame to a bool.
§

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

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

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

Attempt to read the frame as a byte slice.
§

fn encode_len(&self) -> usize

Read the number of bytes necessary to represent the frame and any associated attributes.
§

fn is_normal_pubsub_message(&self) -> bool

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

fn is_pattern_pubsub_message(&self) -> bool

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

fn is_shard_pubsub_message(&self) -> bool

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

fn is_redirection(&self) -> bool

Whether the frame is a MOVED or ASK redirection.
§

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

Convert the frame to a double.
§

impl<B> TryFrom<(FrameKind, B)> for BytesFrame
where B: Into<Bytes>,

§

type Error = RedisProtocolError

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

fn try_from( _: (FrameKind, B), ) -> Result<BytesFrame, <BytesFrame as TryFrom<(FrameKind, B)>>::Error>

Performs the conversion.
source§

impl TryFrom<BytesFrame> for RedisValue

source§

type Error = RedisError

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

fn try_from(value: Resp3Frame) -> Result<Self, Self::Error>

Performs the conversion.
§

impl Eq for BytesFrame

§

impl StructuralPartialEq for BytesFrame

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
§

impl<T> CallHasher for T
where T: Hash + ?Sized,

§

default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64
where H: Hash + ?Sized, B: BuildHasher,

source§

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

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

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

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more