Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(ui): Introduce the AllRemoteEvents type #4370

Merged

Conversation

Hywan
Copy link
Member

@Hywan Hywan commented Dec 3, 2024

A shepherdess gathering a herd of sheep.


Build on top of #4369.

The first patch replaces VecDeque<EventMeta> by AllRemoteEvents which
is a wrapper type around VecDeque<EventMeta>, but this new type aims
at adding semantics API rather than a generic API. It also helps to
isolate the use of these values and to know precisely when and how they
are used.

As a first step, AllRemoteEvents implements a generic API to not break
the existing code. Next patches are revisiting that a little bit step
by step:

  • AllRemoteEvents::back becomes last to add semantics.
  • AllRemoteEvents::iter_mut are removed and get_by_event_id_mut
    is created.

This PR should be reviewed patch-by-patch.


Copy link

codecov bot commented Dec 3, 2024

Codecov Report

Attention: Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.

Project coverage is 85.15%. Comparing base (9be8578) to head (5689a6f).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...tes/matrix-sdk-ui/src/timeline/controller/state.rs 93.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4370      +/-   ##
==========================================
- Coverage   85.18%   85.15%   -0.03%     
==========================================
  Files         280      280              
  Lines       30761    30773      +12     
==========================================
+ Hits        26203    26206       +3     
- Misses       4558     4567       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Hywan Hywan changed the title refactor(ui): Introduce the AllRemoteEvents type refactor(ui): Introduce the AllRemoteEvents type Dec 3, 2024
@Hywan Hywan force-pushed the refactor-ui-timeline-all-remote-events-type branch from 904548d to 84bd2e1 Compare December 3, 2024 12:22
Hywan added 3 commits December 3, 2024 13:26
This patch replaces `VecDeque<EventMeta>` by `AllRemoteEvents` which
is a wrapper type around `VecDeque<EventMeta>`, but this new type aims
at adding semantics API rather than a generic API. It also helps to
isolate the use of these values and to know precisely when and how they
are used.

As a first step, `AllRemoteEvents` implements a generic API to not break
the existing code. Next patches will revisit that a little bit step
by step.
This patch renames `AllRemoteEvents::back` to `last` so that it now gets
a specific semantics instead of being generic.
Having a mutable iterator can be dangerous and is probably too generic
regarding the safety we want to add around the `AllRemoteEvents` type.

This patch removes `iter_mut` and replaces it by its only use case:
`get_by_event_id_mut`.
@Hywan Hywan force-pushed the refactor-ui-timeline-all-remote-events-type branch from 84bd2e1 to 5689a6f Compare December 3, 2024 12:26
@Hywan Hywan marked this pull request as ready for review December 3, 2024 12:27
@Hywan Hywan requested a review from a team as a code owner December 3, 2024 12:27
@Hywan Hywan requested review from stefanceriu and removed request for a team December 3, 2024 12:27
Copy link
Member

@stefanceriu stefanceriu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👍

@Hywan Hywan merged commit d7dff5b into matrix-org:main Dec 3, 2024
41 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants