Module 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§

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

Traits§

Filter
A trait “alias” that represents a filter.

Functions§

new_filter_all
Create a new filter that will run multiple filters. It returns false if at least one of the filter returns false.
new_filter_any
Create a new filter that will run multiple filters. It returns true if at least one of the filter returns true.
new_filter_category
Create a new filter that will accept all rooms that fit in the expected_category. The category is defined by RoomCategory, see this type to learn more.
new_filter_deduplicate_versions
Create a new filter that will filter out room versions that are outdated. Only the “active” versions are kept.
new_filter_favourite
Create a new filter that will filter out rooms that are not marked as favourite (see matrix_sdk_base::Room::is_favourite).
new_filter_fuzzy_match_room_name
Create a new filter that will fuzzy match a pattern on room names.
new_filter_invite
Create a new filter that will filter out rooms that are not invites (see matrix_sdk_base::RoomState::Invited).
new_filter_joined
Create a new filter that will filter out rooms that are not joined (see matrix_sdk_base::RoomState::Joined).
new_filter_non_left
Create a new filter that will filter out left rooms.
new_filter_none
Create a new filter that will reject all entries.
new_filter_normalized_match_room_name
Create a new filter that will “normalized” match a pattern on room names.
new_filter_not
Create a new filter that will negate the inner filter. It returns false if the inner filter returns true, otherwise it returns true.
new_filter_unread
Create a new filter that will filter out rooms that have no unread notifications (different from unread messages), or is not marked as unread.

Type Aliases§

BoxedFilterFnNon-target_family="wasm"
Type alias for a boxed filter function.