Skip to content

Commit 0d037e2

Browse files
committed
refactor: raw_metadata fn for tables now takes Into<row id>.
This change improves ergonomics and makes the API consistent with other getter fns.
1 parent f1774b4 commit 0d037e2

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

src/_macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ macro_rules! build_owned_table_type {
965965

966966
macro_rules! raw_metadata_getter_for_tables {
967967
($idtype: ty) => {
968-
fn raw_metadata(&self, row: $idtype) -> Option<&[u8]> {
968+
fn raw_metadata<I: Into<$idtype>>(&self, row: I) -> Option<&[u8]> {
969969
$crate::sys::tsk_ragged_column_access::<'_, u8, $idtype, _, _>(
970970
row.into(),
971971
self.as_ref().metadata,

src/edge_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn make_edge_table_row(table: &EdgeTable, pos: tsk_id_t) -> Option<EdgeTableRow>
3737
right: table.right(pos)?,
3838
parent: table.parent(pos)?,
3939
child: table.child(pos)?,
40-
metadata: table.raw_metadata(pos.into()).map(|m| m.to_vec()),
40+
metadata: table.raw_metadata(pos).map(|m| m.to_vec()),
4141
})
4242
}
4343

src/individual_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ fn make_individual_table_row(table: &IndividualTable, pos: tsk_id_t) -> Option<I
114114
flags: table.flags(pos)?,
115115
location: table.location(pos).map(|s| s.to_vec()),
116116
parents: table.parents(pos).map(|s| s.to_vec()),
117-
metadata: table.raw_metadata(pos.into()).map(|m| m.to_vec()),
117+
metadata: table.raw_metadata(pos).map(|m| m.to_vec()),
118118
})
119119
}
120120

src/migration_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fn make_migration_table_row(table: &MigrationTable, pos: tsk_id_t) -> Option<Mig
4545
source: table.source(pos)?,
4646
dest: table.dest(pos)?,
4747
time: table.time(pos)?,
48-
metadata: table.raw_metadata(pos.into()).map(|m| m.to_vec()),
48+
metadata: table.raw_metadata(pos).map(|m| m.to_vec()),
4949
})
5050
}
5151

src/mutation_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fn make_mutation_table_row(table: &MutationTable, pos: tsk_id_t) -> Option<Mutat
4545
parent: table.parent(pos)?,
4646
time: table.time(pos)?,
4747
derived_state,
48-
metadata: table.raw_metadata(pos.into()).map(|m| m.to_vec()),
48+
metadata: table.raw_metadata(pos).map(|m| m.to_vec()),
4949
})
5050
}
5151
_ => None,

src/node_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn make_node_table_row(table: &NodeTable, pos: tsk_id_t) -> Option<NodeTableRow>
3939
flags: table.flags(pos)?,
4040
population: table.population(pos)?,
4141
individual: table.individual(pos)?,
42-
metadata: table.raw_metadata(pos.into()).map(|m| m.to_vec()),
42+
metadata: table.raw_metadata(pos).map(|m| m.to_vec()),
4343
})
4444
}
4545

src/population_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fn make_population_table_row(table: &PopulationTable, pos: tsk_id_t) -> Option<P
2626

2727
match index {
2828
i if i < table.num_rows() => {
29-
let metadata = table.raw_metadata(pos.into()).map(|m| m.to_vec());
29+
let metadata = table.raw_metadata(pos).map(|m| m.to_vec());
3030
Some(PopulationTableRow {
3131
id: pos.into(),
3232
metadata,

src/site_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn make_site_table_row(table: &SiteTable, pos: tsk_id_t) -> Option<SiteTableRow>
3434
id: pos.into(),
3535
position: table.position(pos)?,
3636
ancestral_state,
37-
metadata: table.raw_metadata(pos.into()).map(|m| m.to_vec()),
37+
metadata: table.raw_metadata(pos).map(|m| m.to_vec()),
3838
})
3939
}
4040

0 commit comments

Comments
 (0)