@@ -233,16 +233,7 @@ impl MutationTable {
233233 /// Will return [``IndexError``](crate::TskitError::IndexError)
234234 /// if ``row`` is out of range.
235235 pub fn site < M : Into < MutationId > + Copy > ( & self , row : M ) -> Option < SiteId > {
236- assert ! ( self . num_rows( ) == 0 || !self . as_ref( ) . site. is_null( ) ) ;
237- // SAFETY: either the column is empty or the pointer is not null,
238- // in which case the correct lengths are from the low-level objects
239- unsafe {
240- sys:: tsk_column_access :: < SiteId , _ , _ , _ > (
241- row. into ( ) ,
242- self . as_ref ( ) . site ,
243- self . num_rows ( ) ,
244- )
245- }
236+ self . table_ . site ( row. into ( ) )
246237 }
247238
248239 /// Return the ``node`` value from row ``row`` of the table.
@@ -252,16 +243,7 @@ impl MutationTable {
252243 /// Will return [``IndexError``](crate::TskitError::IndexError)
253244 /// if ``row`` is out of range.
254245 pub fn node < M : Into < MutationId > + Copy > ( & self , row : M ) -> Option < NodeId > {
255- assert ! ( self . num_rows( ) == 0 || !self . as_ref( ) . node. is_null( ) ) ;
256- // SAFETY: either the column is empty or the pointer is not null,
257- // in which case the correct lengths are from the low-level objects
258- unsafe {
259- sys:: tsk_column_access :: < NodeId , _ , _ , _ > (
260- row. into ( ) ,
261- self . as_ref ( ) . node ,
262- self . num_rows ( ) ,
263- )
264- }
246+ self . table_ . node ( row. into ( ) )
265247 }
266248
267249 /// Return the ``parent`` value from row ``row`` of the table.
@@ -271,16 +253,7 @@ impl MutationTable {
271253 /// Will return [``IndexError``](crate::TskitError::IndexError)
272254 /// if ``row`` is out of range.
273255 pub fn parent < M : Into < MutationId > + Copy > ( & self , row : M ) -> Option < MutationId > {
274- assert ! ( self . num_rows( ) == 0 || !self . as_ref( ) . parent. is_null( ) ) ;
275- // SAFETY: either the column is empty or the pointer is not null,
276- // in which case the correct lengths are from the low-level objects
277- unsafe {
278- sys:: tsk_column_access :: < MutationId , _ , _ , _ > (
279- row. into ( ) ,
280- self . as_ref ( ) . parent ,
281- self . num_rows ( ) ,
282- )
283- }
256+ self . table_ . parent ( row. into ( ) )
284257 }
285258
286259 /// Return the ``time`` value from row ``row`` of the table.
@@ -290,12 +263,7 @@ impl MutationTable {
290263 /// Will return [``IndexError``](crate::TskitError::IndexError)
291264 /// if ``row`` is out of range.
292265 pub fn time < M : Into < MutationId > + Copy > ( & self , row : M ) -> Option < Time > {
293- assert ! ( self . num_rows( ) == 0 || !self . as_ref( ) . time. is_null( ) ) ;
294- // SAFETY: either the column is empty or the pointer is not null,
295- // in which case the correct lengths are from the low-level objects
296- unsafe {
297- sys:: tsk_column_access :: < Time , _ , _ , _ > ( row. into ( ) , self . as_ref ( ) . time , self . num_rows ( ) )
298- }
266+ self . table_ . time ( row. into ( ) )
299267 }
300268
301269 /// Get the ``derived_state`` value from row ``row`` of the table.
0 commit comments