@@ -1113,6 +1113,45 @@ impl TableCollection {
1113
1113
} ;
1114
1114
handle_tsk_return_value ! ( rv)
1115
1115
}
1116
+
1117
+ #[ cfg( any( doc, feature = "provenance" ) ) ]
1118
+ /// Set the provenance table from an [`OwnedProvenanceTable`](`crate::provenance::OwnedSiteTable`)
1119
+ ///
1120
+ /// # Errors
1121
+ ///
1122
+ /// Any errors from the C API propagate.
1123
+ ///
1124
+ /// # Example
1125
+ ///
1126
+ /// ```rust
1127
+ /// # #[cfg(feature="provenance")] {
1128
+ /// # use tskit::TableAccess;
1129
+ /// let mut tables = tskit::TableCollection::new(1.0).unwrap();
1130
+ /// let mut provenances = tskit::OwnedProvenanceTable::default();
1131
+ /// provenances.add_row("I like pancakes").unwrap();
1132
+ /// tables.set_provenances(&provenances).unwrap();
1133
+ /// assert_eq!(tables.provenances().num_rows(), 1);
1134
+ /// assert_eq!(tables.provenances().record(0), "I like pancakes");
1135
+ /// # provenances.clear().unwrap();
1136
+ /// # assert_eq!(provenances.num_rows(), 0);
1137
+ /// # }
1138
+ /// ```
1139
+ pub fn set_provenances (
1140
+ & mut self ,
1141
+ provenances : & crate :: provenance:: OwnedProvenanceTable ,
1142
+ ) -> TskReturnValue {
1143
+ let rv = unsafe {
1144
+ ll_bindings:: tsk_provenance_table_set_columns (
1145
+ & mut ( * self . inner ) . provenances ,
1146
+ ( * provenances. as_ptr ( ) ) . num_rows ,
1147
+ ( * provenances. as_ptr ( ) ) . timestamp ,
1148
+ ( * provenances. as_ptr ( ) ) . timestamp_offset ,
1149
+ ( * provenances. as_ptr ( ) ) . record ,
1150
+ ( * provenances. as_ptr ( ) ) . record_offset ,
1151
+ )
1152
+ } ;
1153
+ handle_tsk_return_value ! ( rv)
1154
+ }
1116
1155
}
1117
1156
1118
1157
impl TableAccess for TableCollection {
0 commit comments