Skip to main content

per_room

Function per_room 

Source
fn per_room<'a, S, A, B, V, F, Fut>(
    rows: S,
    room: fn(&A) -> &RoomId,
    resolve: F,
) -> impl Stream<Item = Result<Result<(A, V), B>>> + Send + 'a
where S: Stream<Item = Result<Result<A, B>>> + Send + 'a, A: Send + 'a, B: Send + 'a, V: Clone + Send + 'a, F: Fn(OwnedRoomId) -> Fut + Send + Sync + 'a, Fut: Future<Output = Result<V>> + Send + 'a,
Expand description

Pairs each row naming a room with what resolve answers for that room, asking once for each run of consecutive rows in one room.

A walk sorted by room asks once per room and holds only the latest answer, while a row naming no room passes through. A failed answer is yielded in place of the row that asked.