Skip to content

Commit fa14569

Browse files
authored
feat: impl Default for Bookmark (#486)
1 parent 77b5b47 commit fa14569

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

examples/haploid_wright_fisher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ fn simulate(
6464
let parent_picker = rand::distributions::Uniform::new(0, popsize);
6565
let breakpoint_generator = rand::distributions::Uniform::new(0.0, 1.0);
6666
let mut rng = rand::rngs::StdRng::seed_from_u64(seed);
67-
let mut bookmark = tskit::types::Bookmark::new();
67+
let mut bookmark = tskit::types::Bookmark::default();
6868

6969
for birth_time in (0..num_generations).rev() {
7070
for c in children.iter_mut() {

src/types.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ impl Bookmark {
6868
bookmark_setter!(set_provenances, provenances);
6969
}
7070

71+
impl Default for Bookmark {
72+
fn default() -> Self {
73+
Self::new()
74+
}
75+
}
76+
7177
#[cfg(test)]
7278
mod test {
7379

@@ -82,7 +88,7 @@ mod test {
8288

8389
#[test]
8490
fn test_bookmark_mutability() {
85-
let mut b = Bookmark::new();
91+
let mut b = Bookmark::default();
8692
assert_eq!(b.offsets.nodes, 0);
8793
assert_eq!(b.offsets.edges, 0);
8894
assert_eq!(b.offsets.individuals, 0);

0 commit comments

Comments
 (0)