#[non_exhaustive]pub struct IncrexResult {
pub value: Value,
pub actual_increment: Value,
}Expand description
The two-element reply of the INCREX command.
Each field holds the raw Value returned by the server.
For BYINT operations this is an integer, while for BYFLOAT it is a bulk string (RESP2) or double (RESP3).
Decode a field into a concrete type with value_as / actual_increment_as
- e.g.
i64forBYINTorf64(or a wider type such asbigdecimal::BigDecimal) forBYFLOAT.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.value: ValueThe key’s value after the increment.
actual_increment: ValueThe increment that was actually applied.
This is 0 when the default policy (when SATURATE is not set) rejected an out-of-bounds operation.
In that case value holds the unchanged current value and the TTL is left untouched.
When SATURATE is set, it clamps the result to a bound.
This reflects the clamped delta, which may differ from the requested increment.
Implementations§
Source§impl IncrexResult
impl IncrexResult
Sourcepub fn value_as<T: FromRedisValue>(&self) -> Result<T, ParsingError>
pub fn value_as<T: FromRedisValue>(&self) -> Result<T, ParsingError>
Decode value into the desired type.
- e.g.
i64forBYINToperations andf64or a wider type forBYFLOAToperations.
Sourcepub fn actual_increment_as<T: FromRedisValue>(&self) -> Result<T, ParsingError>
pub fn actual_increment_as<T: FromRedisValue>(&self) -> Result<T, ParsingError>
Decode actual_increment into the desired type.
- e.g.
i64forBYINToperations andf64or a wider type forBYFLOAToperations.
Trait Implementations§
Source§impl Clone for IncrexResult
impl Clone for IncrexResult
Source§fn clone(&self) -> IncrexResult
fn clone(&self) -> IncrexResult
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 IncrexResult
impl Debug for IncrexResult
Source§impl FromRedisValue for IncrexResult
impl FromRedisValue for IncrexResult
Source§fn from_redis_value(v: Value) -> Result<Self, ParsingError>
fn from_redis_value(v: Value) -> Result<Self, ParsingError>
Given a redis
Value this attempts to convert it into the given
destination type. If that fails because it’s not compatible an
appropriate error is generated.Source§fn from_redis_value_ref(v: &Value) -> Result<Self, ParsingError>
fn from_redis_value_ref(v: &Value) -> Result<Self, ParsingError>
Given a redis
Value this attempts to convert it into the given
destination type. If that fails because it’s not compatible an
appropriate error is generated.Source§fn from_redis_value_refs(items: &[Value]) -> Result<Vec<Self>, ParsingError>
fn from_redis_value_refs(items: &[Value]) -> Result<Vec<Self>, ParsingError>
Similar to
from_redis_value_ref but constructs a vector of objects
from another vector of values. This primarily exists internally
to customize the behavior for vectors of tuples.Source§fn from_redis_values(items: Vec<Value>) -> Result<Vec<Self>, ParsingError>
fn from_redis_values(items: Vec<Value>) -> Result<Vec<Self>, ParsingError>
The same as
from_redis_value_refs, but takes a Vec<Value> instead
of a &[Value].Source§fn from_each_redis_values(items: Vec<Value>) -> Vec<Result<Self, ParsingError>>
fn from_each_redis_values(items: Vec<Value>) -> Vec<Result<Self, ParsingError>>
The same as
from_redis_values, but returns a result for each
conversion to make handling them case-by-case possible.Source§fn from_byte_slice(_vec: &[u8]) -> Option<Vec<Self>>
fn from_byte_slice(_vec: &[u8]) -> Option<Vec<Self>>
Convert bytes to a single element vector.
Source§fn from_byte_vec(_vec: Vec<u8>) -> Result<Vec<Self>, ParsingError>
fn from_byte_vec(_vec: Vec<u8>) -> Result<Vec<Self>, ParsingError>
Convert bytes to a single element vector.
Source§impl PartialEq for IncrexResult
impl PartialEq for IncrexResult
impl StructuralPartialEq for IncrexResult
Auto Trait Implementations§
impl Freeze for IncrexResult
impl RefUnwindSafe for IncrexResult
impl Send for IncrexResult
impl Sync for IncrexResult
impl Unpin for IncrexResult
impl UnsafeUnpin for IncrexResult
impl UnwindSafe for IncrexResult
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