Finds the index of the last character in `haystack` that is also present in `needles`. This can be used to find the last occurrence of any character from a specified set, useful in parsing scenarios such as finding the last delimiter in a string. # Arguments `haystack`: The byte slice to search. `needles`: The set of bytes to search for within the haystack. # Returns An `Option ` represe
(haystack: H, needles: Byteset)
| 1432 | /// An `Option<usize>` representing the index of the last occurrence of any byte from |
| 1433 | /// `needles` within `haystack`, if found, otherwise `None`. |
| 1434 | pub fn rfind_byteset<H>(haystack: H, needles: Byteset) -> Option<usize> |
| 1435 | where |
| 1436 | H: AsRef<[u8]>, |
| 1437 | { |
| 1438 | let haystack_ref = haystack.as_ref(); |
| 1439 | let haystack_pointer = haystack_ref.as_ptr() as _; |
| 1440 | let haystack_length = haystack_ref.len(); |
| 1441 | |
| 1442 | let result = unsafe { sz_rfind_byteset(haystack_pointer, haystack_length, &needles as *const _ as *const c_void) }; |
| 1443 | if result.is_null() { |
| 1444 | None |
| 1445 | } else { |
| 1446 | Some(unsafe { result.offset_from(haystack_pointer) }.try_into().unwrap()) |
| 1447 | } |
| 1448 | } |
| 1449 | |
| 1450 | /// Finds the index of the first character in `haystack` that is also present in `needles`. |
| 1451 | /// This function is particularly useful for parsing and tokenization tasks where a set of |
no test coverage detected
searching dependent graphs…