@@ -237,16 +237,7 @@ impl MigrationTable {
237237 /// * `Some(position)` if `row` is valid.
238238 /// * `None` otherwise.
239239 pub fn left < M : Into < MigrationId > + Copy > ( & self , row : M ) -> Option < Position > {
240- assert ! ( self . num_rows( ) == 0 || !self . as_ref( ) . time. is_null( ) ) ;
241- // SAFETY: either the column is empty or the pointer is not null,
242- // in which case the correct lengths are from the low-level objects
243- unsafe {
244- sys:: tsk_column_access :: < Position , _ , _ , _ > (
245- row. into ( ) ,
246- self . as_ref ( ) . left ,
247- self . num_rows ( ) ,
248- )
249- }
240+ self . table_ . left ( row. into ( ) )
250241 }
251242
252243 /// Return the right coordinate for a given row.
@@ -256,35 +247,17 @@ impl MigrationTable {
256247 /// * `Some(positions)` if `row` is valid.
257248 /// * `None` otherwise.
258249 pub fn right < M : Into < MigrationId > + Copy > ( & self , row : M ) -> Option < Position > {
259- assert ! ( self . num_rows( ) == 0 || !self . as_ref( ) . right. is_null( ) ) ;
260- // SAFETY: either the column is empty or the pointer is not null,
261- // in which case the correct lengths are from the low-level objects
262- unsafe {
263- sys:: tsk_column_access :: < Position , _ , _ , _ > (
264- row. into ( ) ,
265- self . as_ref ( ) . right ,
266- self . num_rows ( ) ,
267- )
268- }
250+ self . table_ . right ( row. into ( ) )
269251 }
270252
271253 /// Return the node for a given row.
272254 ///
273255 /// # Returns
274- ///
256+ //
275257 /// * `Some(node)` if `row` is valid.
276258 /// * `None` otherwise.
277259 pub fn node < M : Into < MigrationId > + Copy > ( & self , row : M ) -> Option < NodeId > {
278- assert ! ( self . num_rows( ) == 0 || !self . as_ref( ) . node. is_null( ) ) ;
279- // SAFETY: either the column is empty or the pointer is not null,
280- // in which case the correct lengths are from the low-level objects
281- unsafe {
282- sys:: tsk_column_access :: < NodeId , _ , _ , _ > (
283- row. into ( ) ,
284- self . as_ref ( ) . node ,
285- self . num_rows ( ) ,
286- )
287- }
260+ self . table_ . node ( row. into ( ) )
288261 }
289262
290263 /// Return the source population for a given row.
@@ -294,16 +267,7 @@ impl MigrationTable {
294267 /// * `Some(population)` if `row` is valid.
295268 /// * `None` otherwise.
296269 pub fn source < M : Into < MigrationId > + Copy > ( & self , row : M ) -> Option < PopulationId > {
297- assert ! ( self . num_rows( ) == 0 || !self . as_ref( ) . time. is_null( ) ) ;
298- // SAFETY: either the column is empty or the pointer is not null,
299- // in which case the correct lengths are from the low-level objects
300- unsafe {
301- sys:: tsk_column_access :: < PopulationId , _ , _ , _ > (
302- row. into ( ) ,
303- self . as_ref ( ) . source ,
304- self . num_rows ( ) ,
305- )
306- }
270+ self . table_ . source ( row. into ( ) )
307271 }
308272
309273 /// Return the destination population for a given row.
@@ -313,16 +277,7 @@ impl MigrationTable {
313277 /// * `Some(population)` if `row` is valid.
314278 /// * `None` otherwise.
315279 pub fn dest < M : Into < MigrationId > + Copy > ( & self , row : M ) -> Option < PopulationId > {
316- assert ! ( self . num_rows( ) == 0 || !self . as_ref( ) . dest. is_null( ) ) ;
317- // SAFETY: either the column is empty or the pointer is not null,
318- // in which case the correct lengths are from the low-level objects
319- unsafe {
320- sys:: tsk_column_access :: < PopulationId , _ , _ , _ > (
321- row. into ( ) ,
322- self . as_ref ( ) . dest ,
323- self . num_rows ( ) ,
324- )
325- }
280+ self . table_ . dest ( row. into ( ) )
326281 }
327282
328283 /// Return the time of the migration event for a given row.
@@ -332,12 +287,7 @@ impl MigrationTable {
332287 /// * `Some(time)` if `row` is valid.
333288 /// * `None` otherwise.
334289 pub fn time < M : Into < MigrationId > + Copy > ( & self , row : M ) -> Option < Time > {
335- assert ! ( self . num_rows( ) == 0 || !self . as_ref( ) . time. is_null( ) ) ;
336- // SAFETY: either the column is empty or the pointer is not null,
337- // in which case the correct lengths are from the low-level objects
338- unsafe {
339- sys:: tsk_column_access :: < Time , _ , _ , _ > ( row. into ( ) , self . as_ref ( ) . time , self . num_rows ( ) )
340- }
290+ self . table_ . time ( row. into ( ) )
341291 }
342292
343293 /// Retrieve decoded metadata for a `row`.
0 commit comments