pub struct EventBuilder<C: EventContent> { /* private fields */ }
Implementations§
Source§impl<E: EventContent> EventBuilder<E>
impl<E: EventContent> EventBuilder<E>
pub fn room(self, room_id: &RoomId) -> Self
pub fn sender(self, sender: &UserId) -> Self
pub fn event_id(self, event_id: &EventId) -> Self
pub fn server_ts(self, ts: impl TimestampArg) -> Self
pub fn unsigned_transaction_id(self, transaction_id: &TransactionId) -> Self
Sourcepub fn bundled_relations(
self,
relations: BundledMessageLikeRelations<Raw<AnySyncTimelineEvent>>,
) -> Self
pub fn bundled_relations( self, relations: BundledMessageLikeRelations<Raw<AnySyncTimelineEvent>>, ) -> Self
Adds bundled relations to this event.
Ideally, we’d type-check that an event passed as a relation is the same type as this one, but it’s not trivial to do so because this builder is only generic on the event’s content, not the event type itself; doing so would require many changes, and this is testing code after all.
pub fn state_key(self, state_key: impl Into<String>) -> Self
Sourcepub fn into_raw<T>(self) -> Raw<T>
pub fn into_raw<T>(self) -> Raw<T>
Build an event from the EventBuilder
and convert it into a
serialized and Raw
event.
The generic argument T
allows you to automatically cast the Raw
event into any desired type.
pub fn into_raw_timeline(self) -> Raw<AnyTimelineEvent>
pub fn into_timeline(self) -> TimelineEvent
pub fn into_raw_sync(self) -> Raw<AnySyncTimelineEvent>
pub fn into_sync(self) -> SyncTimelineEvent
Source§impl EventBuilder<RoomEncryptedEventContent>
impl EventBuilder<RoomEncryptedEventContent>
Sourcepub fn into_utd_sync_timeline_event(self) -> SyncTimelineEvent
pub fn into_utd_sync_timeline_event(self) -> SyncTimelineEvent
Turn this event into a SyncTimelineEvent representing a decryption failure
Source§impl EventBuilder<RoomMessageEventContent>
impl EventBuilder<RoomMessageEventContent>
Sourcepub fn in_thread(self, root: &EventId, latest_thread_event: &EventId) -> Self
pub fn in_thread(self, root: &EventId, latest_thread_event: &EventId) -> Self
Adds a thread relation to the root event, setting the latest thread event id too.
Sourcepub fn edit(
self,
edited_event_id: &EventId,
new_content: RoomMessageEventContentWithoutRelation,
) -> Self
pub fn edit( self, edited_event_id: &EventId, new_content: RoomMessageEventContentWithoutRelation, ) -> Self
Adds a replacement relation to the current event, with the new content passed.
Adds a caption to a media event.
Will crash if the event isn’t a media room message.
Source§impl EventBuilder<RoomMemberEventContent>
impl EventBuilder<RoomMemberEventContent>
Sourcepub fn membership(self, state: MembershipState) -> Self
pub fn membership(self, state: MembershipState) -> Self
Set the membership
of the m.room.member
event to the given
MembershipState
.
The default is MembershipState::Join
.
Sourcepub fn display_name(self, display_name: impl Into<String>) -> Self
pub fn display_name(self, display_name: impl Into<String>) -> Self
Set the display name of the m.room.member
event.
Trait Implementations§
Source§impl<C: Debug + EventContent> Debug for EventBuilder<C>
impl<C: Debug + EventContent> Debug for EventBuilder<C>
Source§impl<E: EventContent> From<EventBuilder<E>> for Raw<AnySyncTimelineEvent>
impl<E: EventContent> From<EventBuilder<E>> for Raw<AnySyncTimelineEvent>
Source§fn from(val: EventBuilder<E>) -> Self
fn from(val: EventBuilder<E>) -> Self
Source§impl<E: EventContent> From<EventBuilder<E>> for Raw<AnyTimelineEvent>
impl<E: EventContent> From<EventBuilder<E>> for Raw<AnyTimelineEvent>
Source§fn from(val: EventBuilder<E>) -> Self
fn from(val: EventBuilder<E>) -> Self
Source§impl<E: EventContent> From<EventBuilder<E>> for SyncTimelineEvent
impl<E: EventContent> From<EventBuilder<E>> for SyncTimelineEvent
Source§fn from(val: EventBuilder<E>) -> Self
fn from(val: EventBuilder<E>) -> Self
Auto Trait Implementations§
impl<C> Freeze for EventBuilder<C>where
C: Freeze,
impl<C> RefUnwindSafe for EventBuilder<C>where
C: RefUnwindSafe,
impl<C> Send for EventBuilder<C>where
C: Send,
impl<C> Sync for EventBuilder<C>where
C: Sync,
impl<C> Unpin for EventBuilder<C>where
C: Unpin,
impl<C> UnwindSafe for EventBuilder<C>where
C: UnwindSafe,
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
§impl<T> CompatExt for T
impl<T> CompatExt for T
Source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
Source§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Arc<>