matrix-org / matrix-org/matrix-rust-sdk
Most of the data inside `RoomInfo` is not available from its API
- Dominant language
- Rust
- Stars
- 2.3k
- Forks
- 500
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 106
Description
`BaseRoom::subscribe_info` allows to keep track of changes in the `RoomInfo`. However most of the data in `RoomInfo` is not accessible from its methods but from the methods of `BaseRoom`. That makes receiving the `RoomInfo` from the subscriber not that interesting.
I would like to find a way to have all the `RoomInfo`-related methods on `RoomInfo`, while having a simple way to access them on `Room`. The issue I see is that always using `BaseRoom::clone_info` means we need to clone the whole structure when we might want to use a single field.
Here is what we can't do:
1. Redefining every method on `Room` manually is annoying, and needs to be kept up to date.
2. We can't implement `Deref` because that allows the user to keep a reference to the `RoomInfo`, but it is mutable.
Maybe cloning the `RoomInfo` each time is actually a non-issue, given that it is already what happens with `BaseRoom::subscribe_info`.
Contributor guide
Research direction
Start by reading BaseRoom::subscribe_info, BaseRoom::clone_info, RoomInfo, and Room to understand which methods and data are currently exposed. Compare the existing subscriber and cloning behavior, then define a consistent API design that makes RoomInfo data accessible while keeping Room convenient to use. Done means the chosen approach covers the reported RoomInfo-related methods without exposing an invalid mutable reference.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100