find
The index of the first occurrence of needle in haystack.
The byte-slice counterpart of str::find: the standard library has no subslice search.
Import
Section titled “Import”Cargo feature bytes (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
haystack | &[u8] | The bytes to search in. |
needle | &[u8] | The bytes to look for. |
Returns
Section titled “Returns”Option<usize> — The starting index of the first match, Some(0) for an empty needle, or None when there
is no match.
