Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/site_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ impl SiteTable {
/// Get the position column as a slice
=> position, position_slice_raw, f64);

pub fn position_column(&self) -> impl crate::TableColumn<SiteId, Position> + '_ {
crate::table_column::OpaqueTableColumn(self.position_slice())
}

/// Clear all data from the table
pub fn clear(&mut self) -> Result<i32, TskitError> {
handle_tsk_return_value!(self.table_.clear())
Expand Down
8 changes: 8 additions & 0 deletions tests/test_tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,3 +622,11 @@ fn test_edge_table_column_access() {
assert_eq!(column[edge], tskit::NodeId::from(0));
}
}

#[test]
fn test_site_table_column_access() {
let mut table = tskit::SiteTable::default();
let site = table.add_row(1.0, None).unwrap();
let col = table.position_column();
assert_eq!(col[site], 1.0);
}
Loading