#[non_exhaustive]pub struct RoomRetentionEventContent { /* private fields */ }events and unstable-msc1763 only.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() -> RoomRetentionEventContent
pub fn new() -> RoomRetentionEventContent
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<RoomRetentionEventContent>
pub fn from_range( lifetime_range: impl RangeBounds<Duration>, ) -> Option<RoomRetentionEventContent>
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<RoomRetentionEventContent>
pub fn at_most(self, max: Duration) -> Option<RoomRetentionEventContent>
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<RoomRetentionEventContent>
pub fn at_least(self, min: Duration) -> Option<RoomRetentionEventContent>
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<RoomRetentionEventContent, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<RoomRetentionEventContent, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl From<RedactedRoomRetentionEventContent> for RoomRetentionEventContent
impl From<RedactedRoomRetentionEventContent> for RoomRetentionEventContent
Source§fn from(_value: RedactedRoomRetentionEventContent) -> RoomRetentionEventContent
fn from(_value: RedactedRoomRetentionEventContent) -> RoomRetentionEventContent
Source§impl From<RoomRetentionEventContent> for AnyStateEventContent
impl From<RoomRetentionEventContent> for AnyStateEventContent
Source§fn from(c: RoomRetentionEventContent) -> AnyStateEventContent
fn from(c: RoomRetentionEventContent) -> AnyStateEventContent
Source§impl From<RoomRetentionEventContent> for AnyPossiblyRedactedStateEventContent
impl From<RoomRetentionEventContent> for AnyPossiblyRedactedStateEventContent
Source§fn from(c: RoomRetentionEventContent) -> AnyPossiblyRedactedStateEventContent
fn from(c: RoomRetentionEventContent) -> AnyPossiblyRedactedStateEventContent
impl JsonCastable<AnyPossiblyRedactedStateEventContent> for RoomRetentionEventContent
impl JsonCastable<AnyStateEventContent> for RoomRetentionEventContent
impl JsonCastable<Map<String, Value>> for RoomRetentionEventContent
impl JsonCastable<RedactedRoomRetentionEventContent> for RoomRetentionEventContent
Source§impl PossiblyRedactedStateEventContent for RoomRetentionEventContent
impl PossiblyRedactedStateEventContent 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 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 Serialize for RoomRetentionEventContent
impl Serialize for RoomRetentionEventContent
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§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.Auto Trait Implementations§
impl Freeze for RoomRetentionEventContent
impl RefUnwindSafe for RoomRetentionEventContent
impl Send for RoomRetentionEventContent
impl Sync for RoomRetentionEventContent
impl Unpin for RoomRetentionEventContent
impl UnsafeUnpin for RoomRetentionEventContent
impl UnwindSafe for RoomRetentionEventContent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
Source§impl<T> EventContentFromType for Twhere
T: StaticEventContent + DeserializeOwned,
impl<T> EventContentFromType for Twhere
T: StaticEventContent + DeserializeOwned,
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<> Read more