From a71e7923e002ad96fb90503d7e25905efde86215 Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Wed, 21 May 2025 11:07:57 +0200 Subject: [PATCH] chore(base): Move the `Room::MAX_ENCRYPTED_EVENTS` constant in `latest_event`. This patch moves the declaration of the `Room::MAX_ENCRYPTED_TESTS` constants in the `latest_event` module. --- crates/matrix-sdk-base/src/rooms/latest_event.rs | 6 +++++- crates/matrix-sdk-base/src/rooms/mod.rs | 4 ---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/matrix-sdk-base/src/rooms/latest_event.rs b/crates/matrix-sdk-base/src/rooms/latest_event.rs index a922d8768..9afab1d16 100644 --- a/crates/matrix-sdk-base/src/rooms/latest_event.rs +++ b/crates/matrix-sdk-base/src/rooms/latest_event.rs @@ -13,7 +13,7 @@ // limitations under the License. #[cfg(feature = "e2e-encryption")] -use std::collections::BTreeMap; +use std::{collections::BTreeMap, num::NonZeroUsize}; use super::Room; #[cfg(feature = "e2e-encryption")] @@ -24,6 +24,10 @@ use crate::latest_event::LatestEvent; use ruma::{events::AnySyncTimelineEvent, serde::Raw, OwnedRoomId}; impl Room { + /// The size of the latest_encrypted_events RingBuffer + #[cfg(feature = "e2e-encryption")] + pub(super) const MAX_ENCRYPTED_EVENTS: NonZeroUsize = NonZeroUsize::new(10).unwrap(); + /// Return the last event in this room, if one has been cached during /// sliding sync. pub fn latest_event(&self) -> Option { diff --git a/crates/matrix-sdk-base/src/rooms/mod.rs b/crates/matrix-sdk-base/src/rooms/mod.rs index 50c6dcf5f..6df2011e6 100644 --- a/crates/matrix-sdk-base/src/rooms/mod.rs +++ b/crates/matrix-sdk-base/src/rooms/mod.rs @@ -115,10 +115,6 @@ pub struct Room { } impl Room { - /// The size of the latest_encrypted_events RingBuffer - #[cfg(feature = "e2e-encryption")] - const MAX_ENCRYPTED_EVENTS: std::num::NonZeroUsize = std::num::NonZeroUsize::new(10).unwrap(); - pub(crate) fn new( own_user_id: &UserId, store: Arc,