Skip to content

Commit 093993b

Browse files
committed
Add some comments to pineappl_fktable_optimize
1 parent 7ffc086 commit 093993b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

pineappl_capi/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2295,8 +2295,11 @@ pub unsafe extern "C" fn pineappl_grid_evolve(
22952295
#[no_mangle]
22962296
pub unsafe extern "C" fn pineappl_fktable_optimize(grid: *mut Grid, assumptions: FkAssumptions) {
22972297
let grid = unsafe { &mut *grid };
2298+
// SAFETY: this code has been copied from the `take_mut` crate
22982299
let read_grid = unsafe { std::ptr::read(grid) };
2299-
let mut fktable = FkTable::try_from(read_grid).unwrap();
2300+
let mut fktable = FkTable::try_from(read_grid)
2301+
// UNWRAP: error handling in the CAPI is to abort
2302+
.unwrap();
23002303
fktable.optimize(assumptions);
23012304
unsafe { std::ptr::write(grid, fktable.into_grid()) };
23022305
}

0 commit comments

Comments
 (0)