pub struct LifetimeLimits { /* private fields */ }Available on crate feature
unstable-msc1763 and (crate features client or server) only.Expand description
Global limits for the per-room retention policy lifetimes.
Implementations§
Source§impl LifetimeLimits
impl LifetimeLimits
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new LifetimeLimits object with no limits set.
This method can be combined with the LifetimeLimits::at_least and
LifetimeLimits::at_most methods to configure the individual limits.
§Examples
let content = LifetimeLimits::new()
.at_least(Duration::from_hours(24))?
.at_most(Duration::from_hours(24 * 10))?;Sourcepub fn from_range(lifetime_range: impl RangeBounds<Duration>) -> Option<Self>
pub fn from_range(lifetime_range: impl RangeBounds<Duration>) -> Option<Self>
Create a new LifetimeLimits object from a range.
Returns None if the duration of one of the limits, expressed as milliseconds, doesn’t
fall into the [0, (2^53)-1] range, or if the lower bound of the range is bigger than the
upper bound, i.e. 10..0.
§Examples
let content =
LifetimeLimits::from_range(Duration::from_hours(24)..Duration::from_hours(24 * 10))?;Sourcepub fn at_most(self, max: Duration) -> Option<Self>
pub fn at_most(self, max: Duration) -> Option<Self>
Sets the maximum value that a retention policy limit is allowed to have.
Returns None if the given limit, expressed as milliseconds, doesn’t fall into the [0,
(2^53)-1] range, or if the limits don’t adhere to the max < min constraint.
Trait Implementations§
Source§impl Clone for LifetimeLimits
impl Clone for LifetimeLimits
Source§fn clone(&self) -> LifetimeLimits
fn clone(&self) -> LifetimeLimits
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 moreimpl Copy for LifetimeLimits
Source§impl Debug for LifetimeLimits
impl Debug for LifetimeLimits
Source§impl Default for LifetimeLimits
impl Default for LifetimeLimits
Source§fn default() -> LifetimeLimits
fn default() -> LifetimeLimits
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for LifetimeLimits
impl<'de> Deserialize<'de> for LifetimeLimits
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for LifetimeLimits
impl RefUnwindSafe for LifetimeLimits
impl Send for LifetimeLimits
impl Sync for LifetimeLimits
impl Unpin for LifetimeLimits
impl UnsafeUnpin for LifetimeLimits
impl UnwindSafe for LifetimeLimits
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