@@ -299,6 +299,9 @@ pub trait Source<T> {
299299
300300 /// Invokes `for_each` with the current contents and each time this source's
301301 /// contents are updated.
302+ ///
303+ /// Returning `Err(CallbackDisconnected)` will prevent the callback from
304+ /// being invoked again.
302305 fn for_each_cloned_try < F > ( & self , mut for_each : F ) -> CallbackHandle
303306 where
304307 T : Clone + Send + ' static ,
@@ -307,6 +310,30 @@ pub trait Source<T> {
307310 self . for_each_generational_cloned_try ( move |gen| for_each ( gen. value ) )
308311 }
309312
313+ /// Invokes `for_each` each time this source's contents are updated.
314+ ///
315+ /// Returning `Err(CallbackDisconnected)` will prevent the callback from
316+ /// being invoked again.
317+ fn for_each_subsequent_cloned_try < F > ( & self , mut for_each : F ) -> CallbackHandle
318+ where
319+ T : Clone + Send + ' static ,
320+ F : FnMut ( T ) -> Result < ( ) , CallbackDisconnected > + Send + ' static ,
321+ {
322+ self . for_each_subsequent_generational_cloned_try ( move |gen| for_each ( gen. value ) )
323+ }
324+
325+ /// Invokes `for_each` each time this source's contents are updated.
326+ fn for_each_subsequent_cloned < F > ( & self , mut for_each : F ) -> CallbackHandle
327+ where
328+ T : Clone + Send + ' static ,
329+ F : FnMut ( T ) + Send + ' static ,
330+ {
331+ self . for_each_subsequent_cloned_try ( move |value| {
332+ for_each ( value) ;
333+ Ok ( ( ) )
334+ } )
335+ }
336+
310337 /// Invokes `for_each` with the current contents and each time this source's
311338 /// contents are updated.
312339 fn for_each_cloned < F > ( & self , mut for_each : F ) -> CallbackHandle
0 commit comments