Enum respite::RespValue

source ·
pub enum RespValue {
Show 13 variants Attribute(BTreeMap<RespPrimitive, RespValue>), Array(Vec<RespValue>), Bignum(Bytes), Boolean(bool), Double(OrderedFloat<f64>), Error(Bytes), Integer(i64), Map(BTreeMap<RespPrimitive, RespValue>), Nil, Push(Vec<RespValue>), Set(BTreeSet<RespPrimitive>), String(Bytes), Verbatim(Bytes, Bytes),
}
Expand description

A RESP value, possibly built from many frames.

These values are meant to be used for testing, and thus can be hashed and compared. However, this also makes them far less performant than reading frames directly.

Variants§

Implementations§

source§

impl RespValue

source

pub fn array(&mut self) -> Option<&mut Vec<RespValue>>

Extract a Vec of values, if this value is an array.

source

pub fn error(&self) -> Option<&str>

Extract an error message if this value is an error.

source

pub fn integer(&self) -> Option<i64>

Extract an i64 if this value is an integer.

source

pub fn text(&self) -> Option<&str>

Extract the text value of this value if it has one.

Trait Implementations§

source§

impl Debug for RespValue

source§

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

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

impl<const N: usize> From<&'static [u8; N]> for RespValue

source§

fn from(value: &'static [u8; N]) -> Self

Converts to this type from the input type.
source§

impl From<&'static str> for RespValue

source§

fn from(value: &'static str) -> Self

Converts to this type from the input type.
source§

impl From<String> for RespValue

source§

fn from(value: String) -> Self

Converts to this type from the input type.
source§

impl From<Vec<u8>> for RespValue

source§

fn from(value: Vec<u8>) -> Self

Converts to this type from the input type.
source§

impl From<bool> for RespValue

source§

fn from(value: bool) -> Self

Converts to this type from the input type.
source§

impl From<f64> for RespValue

source§

fn from(value: f64) -> Self

Converts to this type from the input type.
source§

impl From<i32> for RespValue

source§

fn from(value: i32) -> Self

Converts to this type from the input type.
source§

impl From<i64> for RespValue

source§

fn from(value: i64) -> Self

Converts to this type from the input type.
source§

impl Hash for RespValue

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 Ord for RespValue

source§

fn cmp(&self, other: &RespValue) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for RespValue

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for RespValue

source§

fn partial_cmp(&self, other: &RespValue) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl TryFrom<RespValue> for RespPrimitive

§

type Error = RespError

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

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

Performs the conversion.
source§

impl Eq for RespValue

source§

impl StructuralEq for RespValue

source§

impl StructuralPartialEq for RespValue

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.