mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-08 16:04:13 -04:00
feat(sdk): SlidingSync::get_room now takes a ref to OwnedRoomId.
Before this patch, `SlidingSync::get_room` was taking ownership of an `OwnedRoomId`, to only use it as a reference. Thus, calling this method was creating useless clones. This patch updates `SlidingSync::get_room` to receive a reference to `OwnedRoomId`.
This commit is contained in:
@@ -642,7 +642,8 @@ impl SlidingSync {
|
||||
|
||||
pub fn get_room(&self, room_id: String) -> anyhow::Result<Option<Arc<SlidingSyncRoom>>> {
|
||||
let runner = self.inner.clone();
|
||||
Ok(self.inner.get_room(OwnedRoomId::try_from(room_id)?).map(|inner| {
|
||||
|
||||
Ok(self.inner.get_room(&OwnedRoomId::try_from(room_id)?).map(|inner| {
|
||||
Arc::new(SlidingSyncRoom {
|
||||
inner,
|
||||
runner,
|
||||
|
||||
@@ -814,8 +814,8 @@ impl SlidingSync {
|
||||
}
|
||||
|
||||
/// Lookup a specific room
|
||||
pub fn get_room(&self, room_id: OwnedRoomId) -> Option<SlidingSyncRoom> {
|
||||
self.rooms.lock_ref().get(&room_id).cloned()
|
||||
pub fn get_room(&self, room_id: &OwnedRoomId) -> Option<SlidingSyncRoom> {
|
||||
self.rooms.lock_ref().get(room_id).cloned()
|
||||
}
|
||||
|
||||
fn update_to_device_since(&self, since: String) {
|
||||
|
||||
Reference in New Issue
Block a user