Skip to content

Commit b37bb32

Browse files
committed
Add vars_since_snapshot to UnificationTable
1 parent 7f939f0 commit b37bb32

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/unify/mod.rs

+10
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
3434
use std::marker;
3535
use std::fmt::Debug;
36+
use std::ops::Range;
3637

3738
mod backing_vec;
3839
pub use self::backing_vec::{InPlace, UnificationStore};
@@ -299,6 +300,15 @@ impl<S: UnificationStore> UnificationTable<S> {
299300
self.values.len()
300301
}
301302

303+
/// Returns the keys of all variables created since the `snapshot`.
304+
pub fn vars_since_snapshot(
305+
&self,
306+
snapshot: &Snapshot<S>,
307+
) -> Range<S::Key> {
308+
let range = self.values.values_since_snapshot(&snapshot.snapshot);
309+
S::Key::from_index(range.start as u32)..S::Key::from_index(range.end as u32)
310+
}
311+
302312
/// Obtains the current value for a particular key.
303313
/// Not for end-users; they can use `probe_value`.
304314
fn value(&self, key: S::Key) -> &VarValue<S::Key> {

0 commit comments

Comments
 (0)