(haystack: H, needles: Byteset)
| 1403 | /// `needles` within `haystack`, if found, otherwise `None`. |
| 1404 | #[inline(always)] |
| 1405 | pub fn find_byteset<H>(haystack: H, needles: Byteset) -> Option<usize> |
| 1406 | where |
| 1407 | H: AsRef<[u8]>, |
| 1408 | { |
| 1409 | let haystack_ref = haystack.as_ref(); |
| 1410 | let haystack_pointer = haystack_ref.as_ptr() as _; |
| 1411 | let haystack_length = haystack_ref.len(); |
| 1412 | |
| 1413 | let result = unsafe { sz_find_byteset(haystack_pointer, haystack_length, &needles as *const _ as *const c_void) }; |
| 1414 | if result.is_null() { |
| 1415 | None |
| 1416 | } else { |
| 1417 | Some(unsafe { result.offset_from(haystack_pointer) }.try_into().unwrap()) |
| 1418 | } |
| 1419 | } |
| 1420 | |
| 1421 | /// Finds the index of the last character in `haystack` that is also present in `needles`. |
| 1422 | /// This can be used to find the last occurrence of any character from a specified set, |
no test coverage detected
searching dependent graphs…