mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-08-03 11:37:09 -04:00
This patch changes `PinnedEventsCache::new` to receive a `WeakRoom` instead of a `Room`. It then returns a `Result<Self>`, with `Err` if the `WeakRoom` doesn't point to the `Room` anymore. Thus, this patch changes `get_or_init` by `get_or_try_init`, but this one is unstable. So this patch switches from `OnceLock` to `OnceCell`, which provides a stable one. Why this change? Because in a later refactoring, providing a `Room` is a bit annoying: all we will have is a `WeakRoom`. We could do this work of upgrading the `WeakRoom` to a `Room`, but it seems akward as all caches are holding a `WeakRoom` if room is necessary.
192 KiB
192 KiB