MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / flat_map_fallible

Method flat_map_fallible

src/timely-util/src/operator.rs:272–303  ·  view source on GitHub ↗
(
        self,
        name: &str,
        mut logic: L,
    )

Source from the content-addressed store, hash-verified

270 // so the simple `|d1| logic(d1)` closure is load-bearing
271 #[allow(clippy::redundant_closure)]
272 fn flat_map_fallible<DCB, ECB, D2, E, I, L>(
273 self,
274 name: &str,
275 mut logic: L,
276 ) -> (
277 Stream<'scope, T, DCB::Container>,
278 Stream<'scope, T, ECB::Container>,
279 )
280 where
281 DCB: ContainerBuilder + PushInto<D2>,
282 ECB: ContainerBuilder + PushInto<E>,
283 I: IntoIterator<Item = Result<D2, E>>,
284 L: for<'a> FnMut(C1::Item<'a>) -> I + 'static,
285 {
286 self.unary_fallible::<DCB, ECB, _, _>(Pipeline, name, move |_, _| {
287 Box::new(move |input, ok_output, err_output| {
288 input.for_each_time(|time, data| {
289 let mut ok_session = ok_output.session_with_builder(&time);
290 let mut err_session = err_output.session_with_builder(&time);
291 for r in data
292 .flat_map(DrainContainer::drain)
293 .flat_map(|d1| logic(d1))
294 {
295 match r {
296 Ok(d2) => ok_session.give(d2),
297 Err(e) => err_session.give(e),
298 }
299 }
300 })
301 })
302 })
303 }
304
305 fn expire_stream_at(self, name: &str, expiration: T) -> Stream<'scope, T, C1> {
306 let name = format!("expire_stream_at({name})");

Callers

nothing calls this directly

Calls 6

as_collectionMethod · 0.80
flat_mapMethod · 0.45
giveMethod · 0.45
mapMethod · 0.45
into_iterMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected