matrix-rust-sdk icon indicating copy to clipboard operation
matrix-rust-sdk copied to clipboard

Most of the data inside `RoomInfo` is not available from its API

Open zecakeh opened this issue 6 months ago • 0 comments

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.

zecakeh avatar Dec 26 '23 11:12 zecakeh