Struct matrix_sdk_ui::timeline::TimelineBuilder
source · pub struct TimelineBuilder { /* private fields */ }
Expand description
Builder that allows creating and configuring various parts of a
Timeline
.
Implementations§
source§impl TimelineBuilder
impl TimelineBuilder
sourcepub fn with_focus(self, focus: TimelineFocus) -> Self
pub fn with_focus(self, focus: TimelineFocus) -> Self
Sets up the initial focus for this timeline.
This can be changed later on while the timeline is alive.
sourcepub fn with_unable_to_decrypt_hook(self, hook: Arc<UtdHookManager>) -> Self
pub fn with_unable_to_decrypt_hook(self, hook: Arc<UtdHookManager>) -> Self
Sets up a hook to catch unable-to-decrypt (UTD) events for the timeline we’re building.
If it was previously set before, will overwrite the previous one.
sourcepub fn with_internal_id_prefix(self, prefix: String) -> Self
pub fn with_internal_id_prefix(self, prefix: String) -> Self
Sets the internal id prefix for this timeline.
The prefix will be prepended to any internal ID using when generating timeline IDs for this timeline.
sourcepub fn track_read_marker_and_receipts(self) -> Self
pub fn track_read_marker_and_receipts(self) -> Self
Enable tracking of the fully-read marker and the read receipts on the timeline.
sourcepub fn event_filter<F>(self, filter: F) -> Self
pub fn event_filter<F>(self, filter: F) -> Self
Use the given filter to choose whether to add events to the timeline.
§Arguments
filter
- A function that takes a deserialized event, and should returntrue
if the event should be added to theTimeline
.
If this is not overridden, the timeline uses the default filter that
only allows events that are materialized into a Timeline
item. For
instance, reactions and edits don’t get their own timeline item (as
they affect another existing one), so they’re “filtered out” to
reflect that.
You can use the default event filter with
crate::timeline::default_event_filter
so as to chain it with
your own event filter, if you want to avoid situations where a read
receipt would be attached to an event that doesn’t get its own
timeline item.
Note that currently:
- Not all event types have a representation as a
TimelineItem
so these are not added no matter what the filter returns. - It is not possible to filter out
m.room.encrypted
events (otherwise they couldn’t be decrypted when the appropriate room key arrives).
sourcepub fn add_failed_to_parse(self, add: bool) -> Self
pub fn add_failed_to_parse(self, add: bool) -> Self
Whether to add events that failed to deserialize to the timeline.
Defaults to true
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TimelineBuilder
impl !RefUnwindSafe for TimelineBuilder
impl Send for TimelineBuilder
impl Sync for TimelineBuilder
impl Unpin for TimelineBuilder
impl !UnwindSafe for TimelineBuilder
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, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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