@@ -134,6 +134,16 @@ impl Config {
134134 /// that uniquely identifies your project, to avoid clashes. For example,
135135 /// differential dataflow registers a configuration struct under the key
136136 /// "differential".
137+ ///
138+ /// # Examples
139+ /// ```rust
140+ /// let mut config = timely::Config::process(3);
141+ /// config.worker.set("example".to_string(), 7u64);
142+ /// timely::execute(config, |worker| {
143+ /// use crate::timely::worker::AsWorker;
144+ /// assert_eq!(worker.config().get::<u64>("example"), Some(&7));
145+ /// }).unwrap();
146+ /// ```
137147 pub fn set < T > ( & mut self , key : String , val : T ) -> & mut Self
138148 where
139149 T : Send + Sync + ' static ,
@@ -147,6 +157,16 @@ impl Config {
147157 /// Returns `None` if `key` has not previously been set with
148158 /// [`WorkerConfig::set`], or if the specified `T` does not match the `T`
149159 /// from the call to `set`.
160+ ///
161+ /// # Examples
162+ /// ```rust
163+ /// let mut config = timely::Config::process(3);
164+ /// config.worker.set("example".to_string(), 7u64);
165+ /// timely::execute(config, |worker| {
166+ /// use crate::timely::worker::AsWorker;
167+ /// assert_eq!(worker.config().get::<u64>("example"), Some(&7));
168+ /// }).unwrap();
169+ /// ```
150170 pub fn get < T : ' static > ( & self , key : & str ) -> Option < & T > {
151171 self . registry . get ( key) . and_then ( |val| val. downcast_ref ( ) )
152172 }
0 commit comments