pub struct Duration(pub Duration);
Expand description
Duration to second resolution, thin wrapper around time::Duration
allowing for custom
(de)serialisation.
Serialised to/from JSON as a human readable time (e.g. “1m”, “1day”, “1h 22m 58s”). Serialised to/from Redis as u64 seconds.
Tuple Fields
0: Duration
Implementations
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Duration
impl<'de> Deserialize<'de> for Duration
sourcefn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> Result<Duration, D::Error>
fn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> Result<Duration, D::Error>
Deserialize this value from the given Serde deserializer. Read more
sourceimpl FromRedisValue for Duration
impl FromRedisValue for Duration
sourcefn from_redis_value(v: &Value) -> RedisResult<Self>
fn from_redis_value(v: &Value) -> RedisResult<Self>
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. Read moresourcefn from_redis_values(items: &[Value]) -> Result<Vec<Self, Global>, RedisError>
fn from_redis_values(items: &[Value]) -> Result<Vec<Self, Global>, RedisError>
Similar to
from_redis_value
but constructs a vector of objects
from another vector of values. This primarily exists internally
to customize the behavior for vectors of tuples. Read moresourceimpl<'a> ToRedisArgs for &'a Duration
impl<'a> ToRedisArgs for &'a Duration
sourcefn write_redis_args(&self, out: &mut Vec<Vec<u8>>)
fn write_redis_args(&self, out: &mut Vec<Vec<u8>>)
This writes the value into a vector of bytes. Each item
is a single argument. Most items generate a single item. Read more
sourcefn to_redis_args(&self) -> Vec<Vec<u8, Global>, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
fn to_redis_args(&self) -> Vec<Vec<u8, Global>, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
This converts the value into a vector of bytes. Each item
is a single argument. Most items generate a vector of a
single item. Read more
sourcefn describe_numeric_behavior(&self) -> NumericBehavior
fn describe_numeric_behavior(&self) -> NumericBehavior
Returns an information about the contained value with regards
to it’s numeric behavior in a redis context. This is used in
some high level concepts to switch between different implementations
of redis functions (for instance
INCR
vs INCRBYFLOAT
). Read moresourcefn is_single_arg(&self) -> bool
fn is_single_arg(&self) -> bool
Returns an indiciation if the value contained is exactly one
argument. It returns false if it’s zero or more than one. This
is used in some high level functions to intelligently switch
between
GET
and MGET
variants. Read moresourceimpl ToRedisArgs for Duration
impl ToRedisArgs for Duration
sourcefn write_redis_args(&self, out: &mut Vec<Vec<u8>>)
fn write_redis_args(&self, out: &mut Vec<Vec<u8>>)
This writes the value into a vector of bytes. Each item
is a single argument. Most items generate a single item. Read more
sourcefn to_redis_args(&self) -> Vec<Vec<u8, Global>, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
fn to_redis_args(&self) -> Vec<Vec<u8, Global>, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
This converts the value into a vector of bytes. Each item
is a single argument. Most items generate a vector of a
single item. Read more
sourcefn describe_numeric_behavior(&self) -> NumericBehavior
fn describe_numeric_behavior(&self) -> NumericBehavior
Returns an information about the contained value with regards
to it’s numeric behavior in a redis context. This is used in
some high level concepts to switch between different implementations
of redis functions (for instance
INCR
vs INCRBYFLOAT
). Read moresourcefn is_single_arg(&self) -> bool
fn is_single_arg(&self) -> bool
Returns an indiciation if the value contained is exactly one
argument. It returns false if it’s zero or more than one. This
is used in some high level functions to intelligently switch
between
GET
and MGET
variants. Read moreimpl StructuralPartialEq for Duration
Auto Trait Implementations
impl RefUnwindSafe for Duration
impl Send for Duration
impl Sync for Duration
impl Unpin for Duration
impl UnwindSafe for Duration
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more