#[non_exhaustive]pub struct RedactedStateEvent<C: RedactedStateEventContent> {
pub content: C,
pub event_id: OwnedEventId,
pub sender: OwnedUserId,
pub origin_server_ts: MilliSecondsSinceUnixEpoch,
pub room_id: OwnedRoomId,
pub state_key: C::StateKey,
pub unsigned: RedactedUnsigned,
}Expand description
A redacted state event.
RedactedStateEvent implements the comparison traits using only the event_id field, a sorted
list would be sorted lexicographically based on the event’s EventId.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.content: CData specific to the event type.
event_id: OwnedEventIdThe globally unique identifier for the event.
sender: OwnedUserIdThe fully-qualified ID of the user who sent this event.
origin_server_ts: MilliSecondsSinceUnixEpochTimestamp on the originating homeserver when this event was sent.
room_id: OwnedRoomIdThe ID of the room associated with this event.
state_key: C::StateKeyA unique key which defines the overwriting semantics for this piece of room state.
This must be a string type, and is often an empty string.
A state event is keyed by its (type, state_key) tuple. Sending another state event with
the same tuple replaces the previous one.
unsigned: RedactedUnsignedAdditional key-value pairs not signed by the homeserver.
Implementations§
Source§impl<C: RedactedStateEventContent> RedactedStateEvent<C>
impl<C: RedactedStateEventContent> RedactedStateEvent<C>
Sourcepub fn event_type(&self) -> StateEventType
pub fn event_type(&self) -> StateEventType
Get the event’s type.
Source§impl RedactedStateEvent<RedactedRoomMemberEventContent>
impl RedactedStateEvent<RedactedRoomMemberEventContent>
Sourcepub fn details(&self) -> MembershipDetails<'_>
pub fn details(&self) -> MembershipDetails<'_>
Obtain the details about this event that are required to calculate a membership change.
This is required when you want to calculate the change a redacted m.room.member event
made.
Sourcepub fn membership_change<'a>(
&'a self,
prev_details: Option<MembershipDetails<'a>>,
) -> MembershipChange<'a>
pub fn membership_change<'a>( &'a self, prev_details: Option<MembershipDetails<'a>>, ) -> MembershipChange<'a>
Helper function for membership change.
Since redacted events don’t have unsigned.prev_content, you have to pass the .details()
of the previous m.room.member event manually (if there is a previous m.room.member
event).
Check the specification for details.
Sourcepub fn should_redact_events(&self) -> bool
pub fn should_redact_events(&self) -> bool
Determines whether the user’s events should be redacted based on their membership.
Using MSC4293, if redact_events is true, the sender is different to the state key,
and the membership is ban or leave (kick), true is returned. Otherwise, the flag
should be ignored, and false is returned.
Trait Implementations§
Source§impl<C: Clone + RedactedStateEventContent> Clone for RedactedStateEvent<C>
impl<C: Clone + RedactedStateEventContent> Clone for RedactedStateEvent<C>
Source§fn clone(&self) -> RedactedStateEvent<C>
fn clone(&self) -> RedactedStateEvent<C>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<C: Debug + RedactedStateEventContent> Debug for RedactedStateEvent<C>
impl<C: Debug + RedactedStateEventContent> Debug for RedactedStateEvent<C>
Source§impl<'de, C> Deserialize<'de> for RedactedStateEvent<C>where
C: EventContentFromType + RedactedStateEventContent,
impl<'de, C> Deserialize<'de> for RedactedStateEvent<C>where
C: EventContentFromType + RedactedStateEventContent,
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<C: RedactedStateEventContent> From<RedactedStateEvent<C>> for RedactedSyncStateEvent<C>
impl<C: RedactedStateEventContent> From<RedactedStateEvent<C>> for RedactedSyncStateEvent<C>
Source§fn from(event: RedactedStateEvent<C>) -> Self
fn from(event: RedactedStateEvent<C>) -> Self
Source§impl<C: RedactedStateEventContent> Ord for RedactedStateEvent<C>
impl<C: RedactedStateEventContent> Ord for RedactedStateEvent<C>
Source§fn cmp(&self, other: &Self) -> Ordering
fn cmp(&self, other: &Self) -> Ordering
Compares the EventIds of the events and orders them lexicographically.
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<C: RedactedStateEventContent> PartialEq for RedactedStateEvent<C>
impl<C: RedactedStateEventContent> PartialEq for RedactedStateEvent<C>
Source§impl<C: RedactedStateEventContent> PartialOrd for RedactedStateEvent<C>
impl<C: RedactedStateEventContent> PartialOrd for RedactedStateEvent<C>
impl<C: RedactedStateEventContent> Eq for RedactedStateEvent<C>
impl<C: RedactedStateEventContent> JsonCastable<AnyStateEvent> for RedactedStateEvent<C>
impl<C: RedactedStateEventContent> JsonCastable<AnyStrippedStateEvent> for RedactedStateEvent<C>
impl<C: RedactedStateEventContent> JsonCastable<AnySyncStateEvent> for RedactedStateEvent<C>
impl<C: RedactedStateEventContent> JsonCastable<AnySyncTimelineEvent> for RedactedStateEvent<C>
impl<C: RedactedStateEventContent> JsonCastable<AnyTimelineEvent> for RedactedStateEvent<C>
impl<C: RedactedStateEventContent> JsonCastable<Map<String, Value>> for RedactedStateEvent<C>
impl<C: RedactedStateEventContent> JsonCastable<RedactedSyncStateEvent<C>> for RedactedStateEvent<C>
impl<C: StaticStateEventContent + RedactContent> JsonCastable<StateEvent<C>> for RedactedStateEvent<C::Redacted>where
C::Redacted: RedactedStateEventContent,
impl<C: StaticStateEventContent + RedactContent> JsonCastable<SyncStateEvent<C>> for RedactedStateEvent<C::Redacted>where
C::Redacted: RedactedStateEventContent,
Auto Trait Implementations§
impl<C> Freeze for RedactedStateEvent<C>
impl<C> RefUnwindSafe for RedactedStateEvent<C>
impl<C> Send for RedactedStateEvent<C>
impl<C> Sync for RedactedStateEvent<C>
impl<C> Unpin for RedactedStateEvent<C>
impl<C> UnsafeUnpin for RedactedStateEvent<C>
impl<C> UnwindSafe for RedactedStateEvent<C>
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,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§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