chore(base): Remove the get_ of some Client's methods.

This patch renames `Client::get_rooms`, `::get_rooms_filtered` and
`::get_room` to respectively `::rooms`, `::rooms_filtered` and `::room`.
This `get_` prefix isn't really Rust idiomatic.
This commit is contained in:
Ivan Enderlin
2024-01-11 11:48:53 +01:00
parent 408c12fc66
commit 771ddcb91e
2 changed files with 7 additions and 17 deletions

View File

@@ -160,12 +160,12 @@ impl BaseClient {
}
/// Get all the rooms this client knows about.
pub fn get_rooms(&self) -> Vec<Room> {
pub fn rooms(&self) -> Vec<Room> {
self.store.rooms()
}
/// Get all the rooms this client knows about, filtered by room state.
pub fn get_rooms_filtered(&self, filter: RoomStateFilter) -> Vec<Room> {
pub fn rooms_filtered(&self, filter: RoomStateFilter) -> Vec<Room> {
self.store.rooms_filtered(filter)
}
@@ -175,12 +175,6 @@ impl BaseClient {
self.store.get_or_create_room(room_id, room_state, self.roominfo_update_sender.clone())
}
/// Get all the rooms this client knows about.
#[deprecated = "Use get_rooms_filtered with RoomStateFilter::INVITED instead."]
pub fn get_stripped_rooms(&self) -> Vec<Room> {
self.get_rooms_filtered(RoomStateFilter::INVITED)
}
/// Get a reference to the store.
#[allow(unknown_lints, clippy::explicit_auto_deref)]
pub fn store(&self) -> &DynStateStore {

View File

@@ -901,17 +901,13 @@ impl Client {
///
/// This will return the list of joined, invited, and left rooms.
pub fn rooms(&self) -> Vec<Room> {
self.base_client()
.get_rooms()
.into_iter()
.map(|room| Room::new(self.clone(), room))
.collect()
self.base_client().rooms().into_iter().map(|room| Room::new(self.clone(), room)).collect()
}
/// Get all the rooms the client knows about, filtered by room state.
pub fn rooms_filtered(&self, filter: RoomStateFilter) -> Vec<Room> {
self.base_client()
.get_rooms_filtered(filter)
.rooms_filtered(filter)
.into_iter()
.map(|room| Room::new(self.clone(), room))
.collect()
@@ -920,7 +916,7 @@ impl Client {
/// Returns the joined rooms this client knows about.
pub fn joined_rooms(&self) -> Vec<Room> {
self.base_client()
.get_rooms_filtered(RoomStateFilter::JOINED)
.rooms_filtered(RoomStateFilter::JOINED)
.into_iter()
.map(|room| Room::new(self.clone(), room))
.collect()
@@ -929,7 +925,7 @@ impl Client {
/// Returns the invited rooms this client knows about.
pub fn invited_rooms(&self) -> Vec<Room> {
self.base_client()
.get_rooms_filtered(RoomStateFilter::INVITED)
.rooms_filtered(RoomStateFilter::INVITED)
.into_iter()
.map(|room| Room::new(self.clone(), room))
.collect()
@@ -938,7 +934,7 @@ impl Client {
/// Returns the left rooms this client knows about.
pub fn left_rooms(&self) -> Vec<Room> {
self.base_client()
.get_rooms_filtered(RoomStateFilter::LEFT)
.rooms_filtered(RoomStateFilter::LEFT)
.into_iter()
.map(|room| Room::new(self.clone(), room))
.collect()