File tree Expand file tree Collapse file tree 3 files changed +33
-7
lines changed Expand file tree Collapse file tree 3 files changed +33
-7
lines changed Original file line number Diff line number Diff line change @@ -308,7 +308,7 @@ impl EdgeTable {
308
308
right : self . right ( r) ?,
309
309
parent : self . parent ( r) ?,
310
310
child : self . child ( r) ?,
311
- metadata : Some ( self . raw_metadata ( r. into ( ) ) ? ) ,
311
+ metadata : self . raw_metadata ( r. into ( ) ) ,
312
312
} ;
313
313
Some ( view)
314
314
}
Original file line number Diff line number Diff line change @@ -203,12 +203,17 @@ impl PopulationTable {
203
203
/// * `Some(row view)` if `r` is valid
204
204
/// * `None` otherwise
205
205
pub fn row_view < P : Into < PopulationId > + Copy > ( & self , r : P ) -> Option < PopulationTableRowView > {
206
- let view = PopulationTableRowView {
207
- table : self ,
208
- id : r. into ( ) ,
209
- metadata : Some ( self . raw_metadata ( r. into ( ) ) ?) ,
210
- } ;
211
- Some ( view)
206
+ match SizeType :: try_from ( r. into ( ) . 0 ) . ok ( ) {
207
+ Some ( row) if row < self . num_rows ( ) => {
208
+ let view = PopulationTableRowView {
209
+ table : self ,
210
+ id : r. into ( ) ,
211
+ metadata : self . raw_metadata ( r. into ( ) ) ,
212
+ } ;
213
+ Some ( view)
214
+ }
215
+ _ => None ,
216
+ }
212
217
}
213
218
}
214
219
Original file line number Diff line number Diff line change @@ -242,6 +242,27 @@ impl SiteTable {
242
242
let ri = r. into ( ) . 0 ;
243
243
table_row_access ! ( ri, self , make_site_table_row)
244
244
}
245
+
246
+ /// Return a view of row `r` of the table.
247
+ ///
248
+ /// # Parameters
249
+ ///
250
+ /// * `r`: the row id.
251
+ ///
252
+ /// # Returns
253
+ ///
254
+ /// * `Some(row view)` if `r` is valid
255
+ /// * `None` otherwise
256
+ pub fn row_view < S : Into < SiteId > + Copy > ( & self , r : S ) -> Option < SiteTableRowView > {
257
+ let view = SiteTableRowView {
258
+ table : self ,
259
+ id : r. into ( ) ,
260
+ position : self . position ( r) ?,
261
+ ancestral_state : self . ancestral_state ( r) ,
262
+ metadata : self . raw_metadata ( r. into ( ) ) ,
263
+ } ;
264
+ Some ( view)
265
+ }
245
266
}
246
267
247
268
build_owned_table_type ! (
You can’t perform that action at this time.
0 commit comments