MCPcopy Create free account
hub / github.com/ashvardanian/StringZilla / _argsort_permutation_impl

Function _argsort_permutation_impl

rust/stringzilla.rs:2231–2251  ·  view source on GitHub ↗

Helper that takes an adapter (with a concrete type) and performs the FFI call.

(adapter: FAdapter, order: &mut [SortedIdx])

Source from the content-addressed store, hash-verified

2229
2230/// Helper that takes an adapter (with a concrete type) and performs the FFI call.
2231fn _argsort_permutation_impl<FAdapter>(adapter: FAdapter, order: &mut [SortedIdx]) -> Result<(), Status>
2232where
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

Callers 1

argsort_permutation_byFunction · 0.85

Calls 2

sz_sequence_argsortFunction · 0.85
lenMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…