Module matrix_sdk_ui::room_list_service::filters

source ·
Expand description

A collection of room filters.

The room list can provide an access to the rooms per list, like with super::RoomList::entries_with_dynamic_adapters. The provided collection of rooms can be filtered with these filters. A classical usage would be the following:

use matrix_sdk_ui::room_list_service::{
    filters, RoomListDynamicEntriesController,
};

fn configure_room_list(
    entries_controller: &RoomListDynamicEntriesController,
) {
    // _All_ non-left rooms
    // _and_ that fall in the “People” category,
    // _and_ that are marked as favourite,
    // _and_ that are _not_ unread.
    entries_controller.set_filter(Box::new(
        // All
        filters::new_filter_all(vec![
            // Non-left
            Box::new(filters::new_filter_non_left()),
            // People
            Box::new(filters::new_filter_category(
                filters::RoomCategory::People,
            )),
            // Favourite
            Box::new(filters::new_filter_favourite()),
            // Not Unread
            Box::new(filters::new_filter_not(Box::new(
                filters::new_filter_unread(),
            ))),
        ]),
    ));
}

Enums§

  • An enum to represent whether a room is about “people” (strictly 2 users) or “group” (1 or more than 2 users).

Traits§

  • A trait “alias” that represents a filter.

Functions§

Type Aliases§