Skip to content

Commit 558771f

Browse files
committed
add with_capacity helper to SnapshotVec
1 parent 7f53de9 commit 558771f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/snapshot_vec.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ impl<D: SnapshotVecDelegate> SnapshotVec<D> {
6767
}
6868
}
6969

70+
pub fn with_capacity(c: usize) -> SnapshotVec<D> {
71+
SnapshotVec {
72+
values: Vec::with_capacity(c),
73+
undo_log: Vec::new(),
74+
}
75+
}
76+
7077
fn in_snapshot(&self) -> bool {
7178
!self.undo_log.is_empty()
7279
}

0 commit comments

Comments
 (0)