Helper that takes an adapter (with a concrete type) and performs the FFI call.
(adapter: FAdapter, order: &mut [SortedIdx])
| 2229 | |
| 2230 | /// Helper that takes an adapter (with a concrete type) and performs the FFI call. |
| 2231 | fn _argsort_permutation_impl<FAdapter>(adapter: FAdapter, order: &mut [SortedIdx]) -> Result<(), Status> |
| 2232 | where |
| 2233 | FAdapter: Fn(usize) -> &'static [u8], |
| 2234 | { |
| 2235 | let wrapper = _PunnedSliceLookupView { |
| 2236 | get_slice: unsafe { _get_slice_fn::<FAdapter>() }, |
| 2237 | data: &adapter as *const FAdapter as *const c_void, |
| 2238 | }; |
| 2239 | let seq = _SzSequence { |
| 2240 | handle: &wrapper as *const _ as *const c_void, |
| 2241 | count: order.len(), |
| 2242 | get_start: Some(_slice_get_start_punned), |
| 2243 | get_length: Some(_slice_get_length_punned), |
| 2244 | }; |
| 2245 | let status = unsafe { sz_sequence_argsort(&seq, core::ptr::null(), order.as_mut_ptr()) }; |
| 2246 | if status == Status::Success { |
| 2247 | Ok(()) |
| 2248 | } else { |
| 2249 | Err(status) |
| 2250 | } |
| 2251 | } |
| 2252 | |
| 2253 | // ---------------------------------------------------------------------- |
| 2254 | // Intersection functions |
no test coverage detected
searching dependent graphs…