File tree 5 files changed +109
-94
lines changed
5 files changed +109
-94
lines changed Original file line number Diff line number Diff line change @@ -234,7 +234,7 @@ macro_rules! table_row_access {
234
234
macro_rules! iterator_for_nodeiterator {
235
235
( $ty: ty) => {
236
236
impl Iterator for $ty {
237
- type Item = $crate:: tsk_id_t ;
237
+ type Item = $crate:: NodeId ;
238
238
fn next( & mut self ) -> Option <Self :: Item > {
239
239
self . next_node( ) ;
240
240
self . current_node( )
@@ -246,7 +246,10 @@ macro_rules! iterator_for_nodeiterator {
246
246
macro_rules! tree_array_slice {
247
247
( $self: ident, $array: ident, $len: expr) => {
248
248
unsafe {
249
- std:: slice:: from_raw_parts( ( * $self. as_ptr( ) ) . $array as * const tsk_id_t, $len as usize )
249
+ std:: slice:: from_raw_parts(
250
+ ( * $self. as_ptr( ) ) . $array as * const $crate:: NodeId ,
251
+ $len as usize ,
252
+ )
250
253
}
251
254
} ;
252
255
}
Original file line number Diff line number Diff line change @@ -210,6 +210,9 @@ impl_id_traits!(EdgeId);
210
210
/// "Null" identifier value.
211
211
pub const TSK_NULL : tsk_id_t = -1 ;
212
212
213
+ /// "Null" identifier value for [``NodeId``]
214
+ pub const NULL_NODE_ID : NodeId = NodeId ( -1 ) ;
215
+
213
216
pub use edge_table:: { EdgeTable , EdgeTableRow } ;
214
217
pub use error:: TskitError ;
215
218
pub use flags:: * ;
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ pub use crate::tsk_size_t;
6
6
pub use crate :: NodeListGenerator ;
7
7
pub use crate :: TableAccess ;
8
8
pub use crate :: TskitTypeAccess ;
9
+ pub use crate :: NULL_NODE_ID ;
9
10
pub use crate :: TSK_NODE_IS_SAMPLE ;
10
11
pub use crate :: TSK_NULL ;
11
12
pub use streaming_iterator:: DoubleEndedStreamingIterator ;
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ mod tests {
39
39
assert ! ( idmap_option. is_some( ) ) ;
40
40
let idmap = idmap_option. unwrap ( ) ;
41
41
for & i in samples {
42
- assert_ne ! ( idmap[ i as usize ] , TSK_NULL ) ;
42
+ assert_ne ! ( idmap[ usize :: from ( i ) ] , TSK_NULL ) ;
43
43
}
44
44
}
45
45
}
You can’t perform that action at this time.
0 commit comments