1use crate::flow::Flow;
8use crate::sink::Sink;
9use crate::source::Source;
10
11pub struct GraphDsl;
12
13impl GraphDsl {
14 pub fn linear<A, B>(source: Source<A>, flow: Flow<A, B>) -> Source<B>
15 where
16 A: Send + 'static,
17 B: Send + 'static,
18 {
19 source.via(flow)
20 }
21
22 pub async fn run_fold<A, Acc, F>(source: Source<A>, init: Acc, f: F) -> Acc
23 where
24 A: Send + 'static,
25 Acc: Send + 'static,
26 F: FnMut(Acc, A) -> Acc + Send + 'static,
27 {
28 Sink::fold(source, init, f).await
29 }
30}