File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 1010//! [`ProvenanceTable::iter`].
1111//!
1212
13- use std:: ptr:: NonNull ;
14-
1513use crate :: bindings as ll_bindings;
1614use crate :: sys;
1715use crate :: SizeType ;
@@ -141,23 +139,19 @@ impl<'a> streaming_iterator::StreamingIterator for ProvenanceTableRowView<'a> {
141139///
142140#[ derive( Debug ) ]
143141pub struct ProvenanceTable {
144- table_ : NonNull < ll_bindings :: tsk_provenance_table_t > ,
142+ table_ : sys :: LLProvenanceTableRef ,
145143}
146144
147145impl ProvenanceTable {
148146 pub ( crate ) fn new_from_table (
149147 provenances : * mut ll_bindings:: tsk_provenance_table_t ,
150148 ) -> Result < Self , crate :: TskitError > {
151- // FIXME: unwrap
152- let n = NonNull :: new ( provenances) . ok_or_else ( || {
153- crate :: TskitError :: LibraryError ( "null pointer to tsk_provenance_table_t" . to_string ( ) )
154- } ) ?;
155- Ok ( ProvenanceTable { table_ : n } )
149+ let table_ = sys:: LLProvenanceTableRef :: new_from_table ( provenances) ?;
150+ Ok ( ProvenanceTable { table_ } )
156151 }
157152
158153 pub ( crate ) fn as_ref ( & self ) -> & ll_bindings:: tsk_provenance_table_t {
159- // SAFETY: NonNull
160- unsafe { self . table_ . as_ref ( ) }
154+ self . table_ . as_ref ( )
161155 }
162156
163157 /// Return the number of rows
Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ use bindings::tsk_population_table_t;
88use bindings:: tsk_site_table_t;
99use std:: ptr:: NonNull ;
1010
11+ #[ cfg( feature = "provenance" ) ]
12+ use bindings:: tsk_provenance_table_t;
13+
1114macro_rules! basic_lltableref_impl {
1215 ( $lltable: ident, $tsktable: ident) => {
1316 #[ repr( transparent) ]
@@ -41,6 +44,9 @@ basic_lltableref_impl!(LLMigrationTableRef, tsk_migration_table_t);
4144basic_lltableref_impl ! ( LLPopulationTableRef , tsk_population_table_t) ;
4245basic_lltableref_impl ! ( LLIndividualTableRef , tsk_individual_table_t) ;
4346
47+ #[ cfg( feature = "provenance" ) ]
48+ basic_lltableref_impl ! ( LLProvenanceTableRef , tsk_provenance_table_t) ;
49+
4450fn tsk_column_access_detail < R : Into < bindings:: tsk_id_t > , L : Into < bindings:: tsk_size_t > , T : Copy > (
4551 row : R ,
4652 column : * const T ,
You can’t perform that action at this time.
0 commit comments