@@ -225,8 +225,8 @@ impl<'find, 'cache, T> Graph<'find, 'cache, T> {
225
225
}
226
226
}
227
227
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 > > {
230
230
/// Lookup `id` without failing if the commit doesn't exist, and assure that `id` is inserted into our set
231
231
/// with a commit with `new_data()` assigned.
232
232
/// `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>> {
255
255
} ;
256
256
Ok ( self . map . get_mut ( & id) )
257
257
}
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
+ }
258
263
}
259
264
260
- /// commit access
265
+ /// Commit based methods
261
266
impl < ' find , ' cache , T : Default > Graph < ' find , ' cache , Commit < T > > {
262
267
/// Lookup `id` without failing if the commit doesn't exist or `id` isn't a commit,
263
268
/// and assure that `id` is inserted into our set with a commit and default data assigned.
0 commit comments