mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-12 10:00:50 -04:00
Box internally
This commit is contained in:
@@ -54,7 +54,7 @@ impl RoomList {
|
||||
|
||||
move |list| {
|
||||
*entries.lock().unwrap() =
|
||||
Some(list.room_list_filtered_stream(Box::new(|_| true)));
|
||||
Some(list.room_list_filtered_stream(|_| true));
|
||||
|
||||
list
|
||||
}
|
||||
@@ -135,7 +135,7 @@ impl RoomList {
|
||||
|
||||
pub async fn update_entries_stream_filter(
|
||||
&self,
|
||||
filter: Box<dyn Fn(&RoomListEntry) -> bool + Sync + Send>,
|
||||
filter: impl Fn(&RoomListEntry) -> bool + Sync + Send + 'static,
|
||||
) -> Result<(), Error> {
|
||||
let mut entries_stream =
|
||||
self.entries_stream.try_write().map_err(|_| Error::CannotUpdateEntriesFilter)?;
|
||||
|
||||
@@ -646,12 +646,12 @@ async fn test_entries_stream_with_updated_filter() -> Result<(), Error> {
|
||||
|
||||
// Second, update the filter.
|
||||
room_list
|
||||
.update_entries_stream_filter(Box::new(|room_list_entry| {
|
||||
.update_entries_stream_filter(|room_list_entry| {
|
||||
matches!(
|
||||
room_list_entry.as_room_id(),
|
||||
Some(room_id) if room_id.server_name() == "bar.org"
|
||||
)
|
||||
}))
|
||||
})
|
||||
.await?;
|
||||
|
||||
// Third, let's get a new entries stream.
|
||||
|
||||
@@ -135,7 +135,7 @@ impl SlidingSyncList {
|
||||
/// by `filter`.
|
||||
pub fn room_list_filtered_stream(
|
||||
&self,
|
||||
filter: Box<dyn Fn(&RoomListEntry) -> bool + Sync + Send>,
|
||||
filter: impl Fn(&RoomListEntry) -> bool + Sync + Send + 'static,
|
||||
) -> FilteredVectorSubscriber<RoomListEntry, Box<dyn Fn(&RoomListEntry) -> bool + Sync + Send>>
|
||||
{
|
||||
let (_, stream) =
|
||||
|
||||
Reference in New Issue
Block a user