|
1 | 1 | use crate::bindings as ll_bindings; |
2 | 2 | use crate::metadata; |
3 | 3 | use crate::{tsk_flags_t, tsk_id_t, TskitError}; |
4 | | -use crate::{NodeId, PopulationId}; |
| 4 | +use crate::{IndividualId, NodeId, PopulationId}; |
5 | 5 |
|
6 | 6 | /// Row of a [`NodeTable`] |
7 | 7 | pub struct NodeTableRow { |
8 | 8 | pub id: NodeId, |
9 | 9 | pub time: f64, |
10 | 10 | pub flags: tsk_flags_t, |
11 | 11 | pub population: PopulationId, |
12 | | - pub individual: tsk_id_t, |
| 12 | + pub individual: IndividualId, |
13 | 13 | pub metadata: Option<Vec<u8>>, |
14 | 14 | } |
15 | 15 |
|
@@ -146,15 +146,24 @@ impl<'a> NodeTable<'a> { |
146 | 146 | /// |
147 | 147 | /// Will return [``IndexError``](crate::TskitError::IndexError) |
148 | 148 | /// if ``row`` is out of range. |
149 | | - pub fn individual<N: Into<NodeId> + Copy>(&'a self, row: N) -> Result<tsk_id_t, TskitError> { |
150 | | - unsafe_tsk_column_access!(row.into().0, 0, self.num_rows(), self.table_.individual) |
| 149 | + pub fn individual<N: Into<NodeId> + Copy>( |
| 150 | + &'a self, |
| 151 | + row: N, |
| 152 | + ) -> Result<IndividualId, TskitError> { |
| 153 | + unsafe_tsk_column_access!( |
| 154 | + row.into().0, |
| 155 | + 0, |
| 156 | + self.num_rows(), |
| 157 | + self.table_.individual, |
| 158 | + IndividualId |
| 159 | + ) |
151 | 160 | } |
152 | 161 |
|
153 | | - pub fn metadata<N: Into<crate::NodeId>, T: metadata::MetadataRoundtrip>( |
| 162 | + pub fn metadata<T: metadata::MetadataRoundtrip>( |
154 | 163 | &'a self, |
155 | | - row: N, |
| 164 | + row: NodeId, |
156 | 165 | ) -> Result<Option<T>, TskitError> { |
157 | | - let buffer = metadata_to_vector!(self, row.into().0)?; |
| 166 | + let buffer = metadata_to_vector!(self, row.0)?; |
158 | 167 | decode_metadata_row!(T, buffer) |
159 | 168 | } |
160 | 169 |
|
|
0 commit comments