#[non_exhaustive]pub struct InitialStateEvent<C>where
    C: StaticStateEventContent,{
    pub content: C,
    pub state_key: <C as StateEventContent>::StateKey,
}events only.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 as StateEventContent>::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> InitialStateEvent<C>where
    C: StaticStateEventContent,
 
impl<C> InitialStateEvent<C>where
    C: StaticStateEventContent,
Sourcepub fn new(
    state_key: <C as StateEventContent>::StateKey,
    content: C,
) -> InitialStateEvent<C>
 
pub fn new( state_key: <C as StateEventContent>::StateKey, content: C, ) -> InitialStateEvent<C>
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) -> InitialStateEvent<C>where
    C: StaticStateEventContent<StateKey = EmptyStateKey>,
 
pub fn with_empty_state_key(content: C) -> InitialStateEvent<C>where
    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<InitialStateEvent<C>>
 
pub fn to_raw(&self) -> Raw<InitialStateEvent<C>>
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 for InitialStateEvent<C>
 
impl<C> 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 more