#[non_exhaustive]pub struct RoomRetentionEventContent { /* private fields */ }Expand description
The content of an m.room.retention state event.
The m.room.retention state event lets room admins or moderators set or modify the history
retention behaviour for a given room.
This event uses the unstable prefix defined in MSC1763.
Implementations§
Source§impl RoomRetentionEventContent
impl RoomRetentionEventContent
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new RoomRetentionEventContent with no retention limits set.
This method can be combined with the RoomRetentionEventContent::at_least and
RoomRetentionEventContent::at_most methods to configure the individual limits.
§Examples
let content = RoomRetentionEventContent::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 RoomRetentionEventContent 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 = RoomRetentionEventContent::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>
Set the maximum amount of time a message should be kept on the homeserver.
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.
Sourcepub fn at_least(self, min: Duration) -> Option<Self>
pub fn at_least(self, min: Duration) -> Option<Self>
Set the minimum amount of time a message should be kept on the homeserver.
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.
Sourcepub fn max_lifetime(&self) -> Option<Duration>
pub fn max_lifetime(&self) -> Option<Duration>
Get the maximum event lifetime defined by this state event, if any.
Sourcepub fn min_lifetime(&self) -> Option<Duration>
pub fn min_lifetime(&self) -> Option<Duration>
Get the minimum event lifetime defined by this state event, if any.
Trait Implementations§
Source§impl Clone for RoomRetentionEventContent
impl Clone for RoomRetentionEventContent
Source§fn clone(&self) -> RoomRetentionEventContent
fn clone(&self) -> RoomRetentionEventContent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RoomRetentionEventContent
impl Debug for RoomRetentionEventContent
Source§impl Default for RoomRetentionEventContent
impl Default for RoomRetentionEventContent
Source§fn default() -> RoomRetentionEventContent
fn default() -> RoomRetentionEventContent
Source§impl<'de> Deserialize<'de> for RoomRetentionEventContent
impl<'de> Deserialize<'de> for RoomRetentionEventContent
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>,
Source§impl From<RoomRetentionEventContent> for AnyStateEventContent
Available on crate feature unstable-msc1763 only.
impl From<RoomRetentionEventContent> for AnyStateEventContent
unstable-msc1763 only.Source§fn from(c: RoomRetentionEventContent) -> Self
fn from(c: RoomRetentionEventContent) -> Self
Source§impl From<RoomRetentionEventContent> for AnyPossiblyRedactedStateEventContent
Available on crate feature unstable-msc1763 only.
impl From<RoomRetentionEventContent> for AnyPossiblyRedactedStateEventContent
unstable-msc1763 only.Source§fn from(c: PossiblyRedactedRoomRetentionEventContent) -> Self
fn from(c: PossiblyRedactedRoomRetentionEventContent) -> Self
impl JsonCastable<AnyStateEventContent> for RoomRetentionEventContent
unstable-msc1763 only.impl JsonCastable<Map<String, Value>> for RoomRetentionEventContent
impl JsonCastable<RedactedRoomRetentionEventContent> for RoomRetentionEventContent
Source§impl RedactContent for RoomRetentionEventContent
impl RedactContent for RoomRetentionEventContent
Source§type Redacted = RedactedRoomRetentionEventContent
type Redacted = RedactedRoomRetentionEventContent
Source§fn redact(self, _rules: &RedactionRules) -> RedactedRoomRetentionEventContent
fn redact(self, _rules: &RedactionRules) -> RedactedRoomRetentionEventContent
self into a redacted form (removing most or all fields) according to the spec. Read moreSource§impl StateEventContent for RoomRetentionEventContent
impl StateEventContent for RoomRetentionEventContent
Source§type StateKey = EmptyStateKey
type StateKey = EmptyStateKey
state_key field.Source§fn event_type(&self) -> StateEventType
fn event_type(&self) -> StateEventType
m.room.name.Source§impl StaticStateEventContent for RoomRetentionEventContent
impl StaticStateEventContent for RoomRetentionEventContent
Source§type PossiblyRedacted = RoomRetentionEventContent
type PossiblyRedacted = RoomRetentionEventContent
Source§type Unsigned = StateUnsigned<<RoomRetentionEventContent as StaticStateEventContent>::PossiblyRedacted>
type Unsigned = StateUnsigned<<RoomRetentionEventContent as StaticStateEventContent>::PossiblyRedacted>
unsigned field.