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 10
10
//! [`ProvenanceTable::iter`].
11
11
//!
12
12
13
- use std:: ptr:: NonNull ;
14
-
15
13
use crate :: bindings as ll_bindings;
16
14
use crate :: sys;
17
15
use crate :: SizeType ;
@@ -141,23 +139,19 @@ impl<'a> streaming_iterator::StreamingIterator for ProvenanceTableRowView<'a> {
141
139
///
142
140
#[ derive( Debug ) ]
143
141
pub struct ProvenanceTable {
144
- table_ : NonNull < ll_bindings :: tsk_provenance_table_t > ,
142
+ table_ : sys :: LLProvenanceTableRef ,
145
143
}
146
144
147
145
impl ProvenanceTable {
148
146
pub ( crate ) fn new_from_table (
149
147
provenances : * mut ll_bindings:: tsk_provenance_table_t ,
150
148
) -> 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_ } )
156
151
}
157
152
158
153
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 ( )
161
155
}
162
156
163
157
/// 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;
8
8
use bindings:: tsk_site_table_t;
9
9
use std:: ptr:: NonNull ;
10
10
11
+ #[ cfg( feature = "provenance" ) ]
12
+ use bindings:: tsk_provenance_table_t;
13
+
11
14
macro_rules! basic_lltableref_impl {
12
15
( $lltable: ident, $tsktable: ident) => {
13
16
#[ repr( transparent) ]
@@ -41,6 +44,9 @@ basic_lltableref_impl!(LLMigrationTableRef, tsk_migration_table_t);
41
44
basic_lltableref_impl ! ( LLPopulationTableRef , tsk_population_table_t) ;
42
45
basic_lltableref_impl ! ( LLIndividualTableRef , tsk_individual_table_t) ;
43
46
47
+ #[ cfg( feature = "provenance" ) ]
48
+ basic_lltableref_impl ! ( LLProvenanceTableRef , tsk_provenance_table_t) ;
49
+
44
50
fn tsk_column_access_detail < R : Into < bindings:: tsk_id_t > , L : Into < bindings:: tsk_size_t > , T : Copy > (
45
51
row : R ,
46
52
column : * const T ,
You can’t perform that action at this time.
0 commit comments