(
adapter1: FAdapter,
adapter2: GAdapter,
seed: u64,
positions1: &mut [SortedIdx],
positions2: &mut [SortedIdx],
count1: usize,
count2: usize,
)
| 2379 | } |
| 2380 | |
| 2381 | fn _intersection_by_impl<FAdapter, GAdapter>( |
| 2382 | adapter1: FAdapter, |
| 2383 | adapter2: GAdapter, |
| 2384 | seed: u64, |
| 2385 | positions1: &mut [SortedIdx], |
| 2386 | positions2: &mut [SortedIdx], |
| 2387 | count1: usize, |
| 2388 | count2: usize, |
| 2389 | ) -> Result<usize, Status> |
| 2390 | where |
| 2391 | FAdapter: Fn(usize) -> &'static [u8], |
| 2392 | GAdapter: Fn(usize) -> &'static [u8], |
| 2393 | { |
| 2394 | let wrapper1 = _PunnedSliceLookupView { |
| 2395 | get_slice: unsafe { _get_slice_fn::<FAdapter>() }, |
| 2396 | data: &adapter1 as *const FAdapter as *const c_void, |
| 2397 | }; |
| 2398 | let wrapper2 = _PunnedSliceLookupView { |
| 2399 | get_slice: unsafe { _get_slice_fn::<GAdapter>() }, |
| 2400 | data: &adapter2 as *const GAdapter as *const c_void, |
| 2401 | }; |
| 2402 | let seq1 = _SzSequence { |
| 2403 | handle: &wrapper1 as *const _ as *const c_void, |
| 2404 | count: count1, |
| 2405 | get_start: Some(_slice_get_start_punned), |
| 2406 | get_length: Some(_slice_get_length_punned), |
| 2407 | }; |
| 2408 | let seq2 = _SzSequence { |
| 2409 | handle: &wrapper2 as *const _ as *const c_void, |
| 2410 | count: count2, |
| 2411 | get_start: Some(_slice_get_start_punned), |
| 2412 | get_length: Some(_slice_get_length_punned), |
| 2413 | }; |
| 2414 | let mut inter_size: usize = 0; |
| 2415 | let status = unsafe { |
| 2416 | sz_sequence_intersect( |
| 2417 | &seq1, |
| 2418 | &seq2, |
| 2419 | core::ptr::null(), |
| 2420 | seed, |
| 2421 | &mut inter_size as *mut usize, |
| 2422 | positions1.as_mut_ptr(), |
| 2423 | positions2.as_mut_ptr(), |
| 2424 | ) |
| 2425 | }; |
| 2426 | if status == Status::Success { |
| 2427 | Ok(inter_size) |
| 2428 | } else { |
| 2429 | Err(status) |
| 2430 | } |
| 2431 | } |
| 2432 | |
| 2433 | pub trait Matcher<'a> { |
| 2434 | fn find(&self, haystack: &'a [u8]) -> Option<usize>; |
no test coverage detected
searching dependent graphs…