File tree Expand file tree Collapse file tree 5 files changed +109
-94
lines changed Expand file tree Collapse file tree 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 {
234234macro_rules! iterator_for_nodeiterator {
235235 ( $ty: ty) => {
236236 impl Iterator for $ty {
237- type Item = $crate:: tsk_id_t ;
237+ type Item = $crate:: NodeId ;
238238 fn next( & mut self ) -> Option <Self :: Item > {
239239 self . next_node( ) ;
240240 self . current_node( )
@@ -246,7 +246,10 @@ macro_rules! iterator_for_nodeiterator {
246246macro_rules! tree_array_slice {
247247 ( $self: ident, $array: ident, $len: expr) => {
248248 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+ )
250253 }
251254 } ;
252255}
Original file line number Diff line number Diff line change @@ -210,6 +210,9 @@ impl_id_traits!(EdgeId);
210210/// "Null" identifier value.
211211pub const TSK_NULL : tsk_id_t = -1 ;
212212
213+ /// "Null" identifier value for [``NodeId``]
214+ pub const NULL_NODE_ID : NodeId = NodeId ( -1 ) ;
215+
213216pub use edge_table:: { EdgeTable , EdgeTableRow } ;
214217pub use error:: TskitError ;
215218pub use flags:: * ;
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ pub use crate::tsk_size_t;
66pub use crate :: NodeListGenerator ;
77pub use crate :: TableAccess ;
88pub use crate :: TskitTypeAccess ;
9+ pub use crate :: NULL_NODE_ID ;
910pub use crate :: TSK_NODE_IS_SAMPLE ;
1011pub use crate :: TSK_NULL ;
1112pub use streaming_iterator:: DoubleEndedStreamingIterator ;
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ mod tests {
3939 assert ! ( idmap_option. is_some( ) ) ;
4040 let idmap = idmap_option. unwrap ( ) ;
4141 for & i in samples {
42- assert_ne ! ( idmap[ i as usize ] , TSK_NULL ) ;
42+ assert_ne ! ( idmap[ usize :: from ( i ) ] , TSK_NULL ) ;
4343 }
4444 }
4545}
You can’t perform that action at this time.
0 commit comments