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 with_date_divider_mode(self, mode: DateDividerMode) -> Self
pub fn with_date_divider_mode(self, mode: DateDividerMode) -> Self
Chose when to insert the date separators, either in between each day or each month.
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
§impl<T> CompatExt for T
impl<T> CompatExt for T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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<>
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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