pub trait SeqValue<M, V = Vec<u8>> {
// Required methods
fn seq(&self) -> u64;
fn value(&self) -> Option<&V>;
fn into_value(self) -> Option<V>;
fn meta(&self) -> Option<&M>;
// Provided methods
fn unpack(self) -> (u64, Option<V>)
where Self: Sized { ... }
fn expires_at_ms_opt(&self) -> Option<u64>
where M: Expirable { ... }
fn expires_at_ms(&self) -> u64
where M: Expirable { ... }
fn is_expired(&self, now_ms: u64) -> bool
where M: Expirable { ... }
}Expand description
Required Methods§
Sourcefn into_value(self) -> Option<V>
fn into_value(self) -> Option<V>
Consume the value and return the value.
Provided Methods§
Sourcefn unpack(self) -> (u64, Option<V>)where
Self: Sized,
fn unpack(self) -> (u64, Option<V>)where
Self: Sized,
Consume self and return the sequence number and the value.
Sourcefn expires_at_ms_opt(&self) -> Option<u64>where
M: Expirable,
fn expires_at_ms_opt(&self) -> Option<u64>where
M: Expirable,
Return the absolute expire time in millisecond since 1970-01-01 00:00:00.
Sourcefn expires_at_ms(&self) -> u64where
M: Expirable,
fn expires_at_ms(&self) -> u64where
M: Expirable,
Returns the absolute expiration time in milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC).
If no expiration time is set, returns u64::MAX, effectively meaning the value never
expires. This method provides a consistent way to handle both expiring and non-expiring
values.
Sourcefn is_expired(&self, now_ms: u64) -> boolwhere
M: Expirable,
fn is_expired(&self, now_ms: u64) -> boolwhere
M: Expirable,
Return true if the record is expired at the given time in milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC).