#[non_exhaustive]pub struct InitialStateEvent<C: StaticStateEventContent> {
pub content: C,
pub state_key: C::StateKey,
}Expand description
A minimal state event, used for creating a new room.
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.
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.
Defaults to the empty string.
Implementations§
Source§impl<C: StaticStateEventContent> InitialStateEvent<C>
impl<C: StaticStateEventContent> InitialStateEvent<C>
Sourcepub fn new(state_key: C::StateKey, content: C) -> Self
pub fn new(state_key: C::StateKey, content: C) -> Self
Create a new InitialStateEvent for an event type with the given state key.
For cases where the state key is empty,
with_empty_state_key() can be used instead.
Sourcepub fn with_empty_state_key(content: C) -> Selfwhere
C: StaticStateEventContent<StateKey = EmptyStateKey>,
pub fn with_empty_state_key(content: C) -> Selfwhere
C: StaticStateEventContent<StateKey = EmptyStateKey>,
Create a new InitialStateEvent for an event type with an empty state key.
For cases where the state key is not empty, use new().
Sourcepub fn to_raw(&self) -> Raw<Self>
pub fn to_raw(&self) -> Raw<Self>
Shorthand for Raw::new(self).unwrap().
Since none of the content types in Ruma ever return an error in serialization, this will
never panic with C being a type from Ruma. However, if you use a custom content type
with a Serialize implementation that can error (for example because it contains an
enum with one or more variants that use the #[serde(skip)] attribute), this method
can panic.
Sourcepub fn to_raw_any(&self) -> Raw<AnyInitialStateEvent>
pub fn to_raw_any(&self) -> Raw<AnyInitialStateEvent>
Shorthand for self.to_raw().cast::<AnyInitialStateEvent>().
Since none of the content types in Ruma ever return an error in serialization, this will
never panic with C being a type from Ruma. However, if you use a custom content type
with a Serialize implementation that can error (for example because it contains an
enum with one or more variants that use the #[serde(skip)] attribute), this method
can panic.
Trait Implementations§
Source§impl<C: Clone + StaticStateEventContent> Clone for InitialStateEvent<C>
impl<C: Clone + StaticStateEventContent> Clone for InitialStateEvent<C>
Source§fn clone(&self) -> InitialStateEvent<C>
fn clone(&self) -> InitialStateEvent<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 + StaticStateEventContent> Debug for InitialStateEvent<C>
impl<C: Debug + StaticStateEventContent> Debug for InitialStateEvent<C>
Source§impl<C> Default for InitialStateEvent<C>
impl<C> Default for InitialStateEvent<C>
Source§impl<'de, C> Deserialize<'de> for InitialStateEvent<C>where
C: EventContentFromType + StaticStateEventContent,
impl<'de, C> Deserialize<'de> for InitialStateEvent<C>where
C: EventContentFromType + StaticStateEventContent,
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<InitialStateEvent<BeaconInfoEventContent>> for AnyInitialStateEvent
Available on crate feature unstable-msc3489 only.
impl From<InitialStateEvent<BeaconInfoEventContent>> for AnyInitialStateEvent
unstable-msc3489 only.Source§fn from(c: InitialBeaconInfoEvent) -> Self
fn from(c: InitialBeaconInfoEvent) -> Self
Source§impl From<InitialStateEvent<CallMemberEventContent>> for AnyInitialStateEvent
Available on crate feature unstable-msc3401 only.
impl From<InitialStateEvent<CallMemberEventContent>> for AnyInitialStateEvent
unstable-msc3401 only.Source§fn from(c: InitialCallMemberEvent) -> Self
fn from(c: InitialCallMemberEvent) -> Self
Source§impl From<InitialStateEvent<MemberHintsEventContent>> for AnyInitialStateEvent
Available on crate feature unstable-msc4171 only.
impl From<InitialStateEvent<MemberHintsEventContent>> for AnyInitialStateEvent
unstable-msc4171 only.Source§fn from(c: InitialMemberHintsEvent) -> Self
fn from(c: InitialMemberHintsEvent) -> Self
Source§impl From<InitialStateEvent<PolicyRuleRoomEventContent>> for AnyInitialStateEvent
impl From<InitialStateEvent<PolicyRuleRoomEventContent>> for AnyInitialStateEvent
Source§fn from(c: InitialPolicyRuleRoomEvent) -> Self
fn from(c: InitialPolicyRuleRoomEvent) -> Self
Source§impl From<InitialStateEvent<PolicyRuleServerEventContent>> for AnyInitialStateEvent
impl From<InitialStateEvent<PolicyRuleServerEventContent>> for AnyInitialStateEvent
Source§fn from(c: InitialPolicyRuleServerEvent) -> Self
fn from(c: InitialPolicyRuleServerEvent) -> Self
Source§impl From<InitialStateEvent<PolicyRuleUserEventContent>> for AnyInitialStateEvent
impl From<InitialStateEvent<PolicyRuleUserEventContent>> for AnyInitialStateEvent
Source§fn from(c: InitialPolicyRuleUserEvent) -> Self
fn from(c: InitialPolicyRuleUserEvent) -> Self
Source§impl From<InitialStateEvent<RoomAliasesEventContent>> for AnyInitialStateEvent
impl From<InitialStateEvent<RoomAliasesEventContent>> for AnyInitialStateEvent
Source§fn from(c: InitialRoomAliasesEvent) -> Self
fn from(c: InitialRoomAliasesEvent) -> Self
Source§impl From<InitialStateEvent<RoomAvatarEventContent>> for AnyInitialStateEvent
impl From<InitialStateEvent<RoomAvatarEventContent>> for AnyInitialStateEvent
Source§fn from(c: InitialRoomAvatarEvent) -> Self
fn from(c: InitialRoomAvatarEvent) -> Self
Source§impl From<InitialStateEvent<RoomCanonicalAliasEventContent>> for AnyInitialStateEvent
impl From<InitialStateEvent<RoomCanonicalAliasEventContent>> for AnyInitialStateEvent
Source§fn from(c: InitialRoomCanonicalAliasEvent) -> Self
fn from(c: InitialRoomCanonicalAliasEvent) -> Self
Source§impl From<InitialStateEvent<RoomCreateEventContent>> for AnyInitialStateEvent
impl From<InitialStateEvent<RoomCreateEventContent>> for AnyInitialStateEvent
Source§fn from(c: InitialRoomCreateEvent) -> Self
fn from(c: InitialRoomCreateEvent) -> Self
Source§impl From<InitialStateEvent<RoomEncryptionEventContent>> for AnyInitialStateEvent
impl From<InitialStateEvent<RoomEncryptionEventContent>> for AnyInitialStateEvent
Source§fn from(c: InitialRoomEncryptionEvent) -> Self
fn from(c: InitialRoomEncryptionEvent) -> Self
Source§impl From<InitialStateEvent<RoomGuestAccessEventContent>> for AnyInitialStateEvent
impl From<InitialStateEvent<RoomGuestAccessEventContent>> for AnyInitialStateEvent
Source§fn from(c: InitialRoomGuestAccessEvent) -> Self
fn from(c: InitialRoomGuestAccessEvent) -> Self
Source§impl From<InitialStateEvent<RoomHistoryVisibilityEventContent>> for AnyInitialStateEvent
impl From<InitialStateEvent<RoomHistoryVisibilityEventContent>> for AnyInitialStateEvent
Source§fn from(c: InitialRoomHistoryVisibilityEvent) -> Self
fn from(c: InitialRoomHistoryVisibilityEvent) -> Self
Source§impl From<InitialStateEvent<RoomImagePackEventContent>> for AnyInitialStateEvent
Available on crate feature unstable-msc2545 only.
impl From<InitialStateEvent<RoomImagePackEventContent>> for AnyInitialStateEvent
unstable-msc2545 only.Source§fn from(c: InitialRoomImagePackEvent) -> Self
fn from(c: InitialRoomImagePackEvent) -> Self
Source§impl From<InitialStateEvent<RoomJoinRulesEventContent>> for AnyInitialStateEvent
impl From<InitialStateEvent<RoomJoinRulesEventContent>> for AnyInitialStateEvent
Source§fn from(c: InitialRoomJoinRulesEvent) -> Self
fn from(c: InitialRoomJoinRulesEvent) -> Self
Source§impl From<InitialStateEvent<RoomLanguageEventContent>> for AnyInitialStateEvent
Available on crate feature unstable-msc4334 only.
impl From<InitialStateEvent<RoomLanguageEventContent>> for AnyInitialStateEvent
unstable-msc4334 only.Source§fn from(c: InitialRoomLanguageEvent) -> Self
fn from(c: InitialRoomLanguageEvent) -> Self
Source§impl From<InitialStateEvent<RoomMemberEventContent>> for AnyInitialStateEvent
impl From<InitialStateEvent<RoomMemberEventContent>> for AnyInitialStateEvent
Source§fn from(c: InitialRoomMemberEvent) -> Self
fn from(c: InitialRoomMemberEvent) -> Self
Source§impl From<InitialStateEvent<RoomNameEventContent>> for AnyInitialStateEvent
impl From<InitialStateEvent<RoomNameEventContent>> for AnyInitialStateEvent
Source§fn from(c: InitialRoomNameEvent) -> Self
fn from(c: InitialRoomNameEvent) -> Self
Source§impl From<InitialStateEvent<RoomPinnedEventsEventContent>> for AnyInitialStateEvent
impl From<InitialStateEvent<RoomPinnedEventsEventContent>> for AnyInitialStateEvent
Source§fn from(c: InitialRoomPinnedEventsEvent) -> Self
fn from(c: InitialRoomPinnedEventsEvent) -> Self
Source§impl From<InitialStateEvent<RoomPowerLevelsEventContent>> for AnyInitialStateEvent
impl From<InitialStateEvent<RoomPowerLevelsEventContent>> for AnyInitialStateEvent
Source§fn from(c: InitialRoomPowerLevelsEvent) -> Self
fn from(c: InitialRoomPowerLevelsEvent) -> Self
Source§impl From<InitialStateEvent<RoomServerAclEventContent>> for AnyInitialStateEvent
impl From<InitialStateEvent<RoomServerAclEventContent>> for AnyInitialStateEvent
Source§fn from(c: InitialRoomServerAclEvent) -> Self
fn from(c: InitialRoomServerAclEvent) -> Self
Source§impl From<InitialStateEvent<RoomThirdPartyInviteEventContent>> for AnyInitialStateEvent
impl From<InitialStateEvent<RoomThirdPartyInviteEventContent>> for AnyInitialStateEvent
Source§fn from(c: InitialRoomThirdPartyInviteEvent) -> Self
fn from(c: InitialRoomThirdPartyInviteEvent) -> Self
Source§impl From<InitialStateEvent<RoomTombstoneEventContent>> for AnyInitialStateEvent
impl From<InitialStateEvent<RoomTombstoneEventContent>> for AnyInitialStateEvent
Source§fn from(c: InitialRoomTombstoneEvent) -> Self
fn from(c: InitialRoomTombstoneEvent) -> Self
Source§impl From<InitialStateEvent<RoomTopicEventContent>> for AnyInitialStateEvent
impl From<InitialStateEvent<RoomTopicEventContent>> for AnyInitialStateEvent
Source§fn from(c: InitialRoomTopicEvent) -> Self
fn from(c: InitialRoomTopicEvent) -> Self
Source§impl From<InitialStateEvent<SpaceChildEventContent>> for AnyInitialStateEvent
impl From<InitialStateEvent<SpaceChildEventContent>> for AnyInitialStateEvent
Source§fn from(c: InitialSpaceChildEvent) -> Self
fn from(c: InitialSpaceChildEvent) -> Self
Source§impl From<InitialStateEvent<SpaceParentEventContent>> for AnyInitialStateEvent
impl From<InitialStateEvent<SpaceParentEventContent>> for AnyInitialStateEvent
Source§fn from(c: InitialSpaceParentEvent) -> Self
fn from(c: InitialSpaceParentEvent) -> Self
Source§impl From<InitialStateEvent<StateRoomEncryptedEventContent>> for AnyInitialStateEvent
Available on crate feature unstable-msc3414 only.
impl From<InitialStateEvent<StateRoomEncryptedEventContent>> for AnyInitialStateEvent
unstable-msc3414 only.