From 4ca536395bb28f6aea6c8479efbbabe8103e5223 Mon Sep 17 00:00:00 2001 From: Eli Lindsey Date: Mon, 9 Nov 2020 17:57:06 -0500 Subject: [PATCH] add a convenience function to make named dataflows with otherwise default arguments --- timely/src/worker.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/timely/src/worker.rs b/timely/src/worker.rs index 0ed6b9d59..317028d1f 100644 --- a/timely/src/worker.rs +++ b/timely/src/worker.rs @@ -371,6 +371,30 @@ impl Worker { self.dataflow_core("Dataflow", logging, Box::new(()), |_, child| func(child)) } + /// Construct a new dataflow with a (purely cosmetic) name. + /// + /// # Examples + /// ``` + /// timely::execute_from_args(::std::env::args(), |worker| { + /// + /// // We must supply the timestamp type here, although + /// // it would generally be determined by type inference. + /// worker.dataflow_named::("Some Dataflow", |scope| { + /// + /// // uses of `scope` to build dataflow + /// + /// }); + /// }); + /// ``` + pub fn dataflow_named(&mut self, name: &str, func: F) -> R + where + T: Refines<()>, + F: FnOnce(&mut Child)->R, + { + let logging = self.logging.borrow_mut().get("timely"); + self.dataflow_core(name, logging, Box::new(()), |_, child| func(child)) + } + /// Construct a new dataflow with specific configurations. /// /// This method constructs a new dataflow, using a name, logger, and additional