Skip to content

Commit 61eadf3

Browse files
committed
aha, design problem
1 parent da0a208 commit 61eadf3

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/table_column.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ impl<T> TableColumn<'_, T> {
88
}
99
}
1010

11+
impl<T> TableColumn<'_, T>
12+
where
13+
T: Copy,
14+
{
15+
pub fn iter(&self) -> impl Iterator<Item = T> + '_ {
16+
self.0.iter().cloned()
17+
}
18+
}
19+
1120
#[derive(Debug)]
1221
#[repr(transparent)]
1322
pub struct MutableTableColumn<'table, T>(&'table mut [T]);

tests/test_tables.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,3 +550,11 @@ mod test_metadata_round_trips {
550550
);
551551
}
552552
}
553+
554+
#[test]
555+
fn test_node_table_inidividual_column() {
556+
let mut t = tskit::NodeTable::new().unwrap();
557+
let node = t.add_row(tskit::NodeFlags::new_sample(), 0.0, -1, -1).unwrap();
558+
let individual = t.individual_column();
559+
assert_eq(individual[node], tskit::IndividualId::NULL);
560+
}

0 commit comments

Comments
 (0)