Skip to content

Commit 32da441

Browse files
committed
Add a value_count field to sv::Snapshot
1 parent 69b3d20 commit 32da441

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/snapshot_vec.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ impl<D> fmt::Debug for SnapshotVec<D>
6060

6161
// Snapshots are tokens that should be created/consumed linearly.
6262
pub struct Snapshot {
63+
// Number of values at the time the snapshot was taken.
64+
pub(crate) value_count: usize,
6365
// Length of the undo log at the time the snapshot was taken.
6466
undo_len: usize,
6567
}
@@ -173,10 +175,9 @@ impl<D: SnapshotVecDelegate> SnapshotVec<D> {
173175
}
174176

175177
pub fn start_snapshot(&mut self) -> Snapshot {
176-
let length = self.undo_log.len();
177178
self.num_open_snapshots += 1;
178-
Snapshot { length: length }
179179
Snapshot {
180+
value_count: self.values.len(),
180181
undo_len: self.undo_log.len(),
181182
}
182183
}

0 commit comments

Comments
 (0)