matrix_sdk_ui/room_list_service/filters/none.rs
1// Copyright 2024 The Matrix.org Foundation C.I.C.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use super::Filter;
16
17/// Create a new filter that will reject all entries.
18pub fn new_filter() -> impl Filter {
19 |_room| -> bool { false }
20}
21
22#[cfg(test)]
23mod tests {
24 use std::ops::Not;
25
26 use matrix_sdk::test_utils::logged_in_client_with_server;
27 use matrix_sdk_test::async_test;
28 use ruma::room_id;
29
30 use super::{super::new_rooms, *};
31
32 #[async_test]
33 async fn test_all_kind_of_room_list_entry() {
34 let (client, server) = logged_in_client_with_server().await;
35 let [room] = new_rooms([room_id!("!a:b.c")], &client, &server).await;
36
37 let none = new_filter();
38
39 assert!(none(&room).not());
40 }
41}