@@ -225,8 +225,8 @@ impl<'find, 'cache, T> Graph<'find, 'cache, T> {
225225 }
226226}
227227
228- /// commit access
229- impl < ' find , ' cache , T > Graph < ' find , ' cache , Commit < T > > {
228+ /// Commit based methods
229+ impl < ' find , ' cache , T > Graph < ' find , ' cache , crate :: graph :: Commit < T > > {
230230 /// Lookup `id` without failing if the commit doesn't exist, and assure that `id` is inserted into our set
231231 /// with a commit with `new_data()` assigned.
232232 /// `update_data(data)` gets run either on existing or on new data.
@@ -255,9 +255,14 @@ impl<'find, 'cache, T> Graph<'find, 'cache, Commit<T>> {
255255 } ;
256256 Ok ( self . map . get_mut ( & id) )
257257 }
258+
259+ /// For each stored commit, call `clear` on its data.
260+ pub fn clear_commit_data ( & mut self , mut clear : impl FnMut ( & mut T ) ) {
261+ self . map . values_mut ( ) . for_each ( |c| clear ( & mut c. data ) ) ;
262+ }
258263}
259264
260- /// commit access
265+ /// Commit based methods
261266impl < ' find , ' cache , T : Default > Graph < ' find , ' cache , Commit < T > > {
262267 /// Lookup `id` without failing if the commit doesn't exist or `id` isn't a commit,
263268 /// and assure that `id` is inserted into our set with a commit and default data assigned.
0 commit comments