matrix_sdk_ui::timeline

Struct EventTimelineItem

Source
pub struct EventTimelineItem { /* private fields */ }
Expand description

An item in the timeline that represents at least one event.

There is always one main event that gives the EventTimelineItem its identity but in many cases, additional events like reactions and edits are also part of the item.

Implementations§

Source§

impl EventTimelineItem

Source

pub async fn from_latest_event( client: Client, room_id: &RoomId, latest_event: LatestEvent, ) -> Option<EventTimelineItem>

If the supplied low-level SyncTimelineEvent is suitable for use as the latest_event in a message preview, wrap it as an EventTimelineItem.

Note: Timeline items created via this constructor do not produce the correct ShieldState when calling get_shield. This is because they are intended for display in the room list which a) is unlikely to show shields and b) would incur a significant performance overhead.

Source

pub fn is_local_echo(&self) -> bool

Check whether this item is a local echo.

This returns true for events created locally, until the server echoes back the full event as part of a sync response.

This is the opposite of Self::is_remote_event.

Source

pub fn is_remote_event(&self) -> bool

Check whether this item is a remote event.

This returns true only for events that have been echoed back from the homeserver. A local echo sent but not echoed back yet will return false here.

This is the opposite of Self::is_local_echo.

Source

pub fn send_state(&self) -> Option<&EventSendState>

Get the event’s send state of a local echo.

Source

pub fn identifier(&self) -> TimelineEventItemId

Get the unique identifier of this item.

Returns the transaction ID for a local echo item that has not been sent and the event ID for a local echo item that has been sent or a remote item.

Source

pub fn transaction_id(&self) -> Option<&TransactionId>

Get the transaction ID of a local echo item.

The transaction ID is currently only kept until the remote echo for a local event is received.

Source

pub fn event_id(&self) -> Option<&EventId>

Get the event ID of this item.

If this returns Some(_), the event was successfully created by the server.

Even if this is a local event, this can be Some(_) as the event ID can be known not just from the remote echo via sync_events, but also from the response of the send request that created the event.

Source

pub fn sender(&self) -> &UserId

Get the sender of this item.

Source

pub fn sender_profile(&self) -> &TimelineDetails<Profile>

Get the profile of the sender.

Source

pub fn content(&self) -> &TimelineItemContent

Get the content of this item.

Source

pub fn reactions(&self) -> &ReactionsByKeyBySender

Get the reactions of this item.

Source

pub fn read_receipts(&self) -> &IndexMap<OwnedUserId, Receipt>

Get the read receipts of this item.

The key is the ID of a room member and the value are details about the read receipt.

Note that currently this ignores threads.

Source

pub fn timestamp(&self) -> MilliSecondsSinceUnixEpoch

Get the timestamp of this item.

If this event hasn’t been echoed back by the server yet, returns the time the local event was created. Otherwise, returns the origin server timestamp.

Source

pub fn is_own(&self) -> bool

Whether this timeline item was sent by the logged-in user themselves.

Source

pub fn is_editable(&self) -> bool

Flag indicating this timeline item can be edited by the current user.

Source

pub fn is_highlighted(&self) -> bool

Whether the event should be highlighted in the timeline.

Source

pub fn encryption_info(&self) -> Option<&EncryptionInfo>

Get the encryption information for the event, if any.

Source

pub fn get_shield(&self, strict: bool) -> Option<ShieldState>

Gets the ShieldState which can be used to decorate messages in the recommended way.

Source

pub fn can_be_replied_to(&self) -> bool

Check whether this item can be replied to.

Source

pub fn original_json(&self) -> Option<&Raw<AnySyncTimelineEvent>>

Get the raw JSON representation of the initial event (the one that caused this timeline item to be created).

Returns None if this event hasn’t been echoed back by the server yet.

Source

pub fn latest_edit_json(&self) -> Option<&Raw<AnySyncTimelineEvent>>

Get the raw JSON representation of the latest edit, if any.

Source

pub fn latest_json(&self) -> Option<&Raw<AnySyncTimelineEvent>>

Shorthand for item.latest_edit_json().or_else(|| item.original_json()).

Source

pub fn origin(&self) -> Option<EventItemOrigin>

Get the origin of the event, i.e. where it came from.

May return None in some edge cases that are subject to change.

Source

pub fn with_reactions(&self, reactions: ReactionsByKeyBySender) -> Self

Clone the current event item, and update its reactions.

Source

pub fn replied_to_info(&self) -> Result<RepliedToInfo, UnsupportedReplyItem>

Gives the information needed to reply to the event of the item.

Source

pub fn local_echo_send_handle(&self) -> Option<SendHandle>

For local echoes, return the associated send handle.

Trait Implementations§

Source§

impl Clone for EventTimelineItem

Source§

fn clone(&self) -> EventTimelineItem

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EventTimelineItem

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<EventTimelineItem> for TimelineItemKind

Source§

fn from(item: EventTimelineItem) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> CompatExt for T

§

fn compat(self) -> Compat<T>

Applies the [Compat] adapter by value. Read more
§

fn compat_ref(&self) -> Compat<&T>

Applies the [Compat] adapter by shared reference. Read more
§

fn compat_mut(&mut self) -> Compat<&mut T>

Applies the [Compat] adapter by mutable reference. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T, UT> HandleAlloc<UT> for T
where T: Send + Sync,

Source§

fn new_handle(value: Arc<T>) -> Handle

Create a new handle for an Arc value Read more
Source§

fn clone_handle(handle: Handle) -> Handle

Clone a handle Read more
Source§

fn consume_handle(handle: Handle) -> Arc<T>

Consume a handle, getting back the initial Arc<>
Source§

fn get_arc(handle: Handle) -> Arc<Self>

Get a clone of the Arc<> using a “borrowed” handle. Read more
Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

impl<T> Identity for T
where T: ?Sized,

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> Any for T
where T: Any,

Source§

impl<T> AsyncTraitDeps for T

Source§

impl<T> CloneAny for T
where T: Any + Clone,

Source§

impl<T> CloneAnySend for T
where T: Any + Send + Clone,

Source§

impl<T> CloneAnySendSync for T
where T: Any + Send + Sync + Clone,

Source§

impl<T> CloneAnySync for T
where T: Any + Sync + Clone,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T

Source§

impl<T> SendOutsideWasm for T
where T: Send,

Source§

impl<T> SyncOutsideWasm for T
where T: Sync,