pub trait SearchIn<'a>: Sized {
// Required methods
fn search_in(&self, haystack: &'a str) -> Option<usize>;
fn rsearch_in(&self, haystack: &'a str) -> Option<usize>;
fn search_in_ignore_ascii_case(&self, haystack: &'a str) -> Option<usize>;
fn rsearch_in_ignore_ascii_case(&self, haystack: &'a str) -> Option<usize>;
fn len(&self) -> usize;
// Provided methods
fn is_empty(&self) -> bool { ... }
fn includes_in(&self, haystack: &'a str) -> bool { ... }
fn includes_in_ignore_ascii_case(&self, haystack: &'a str) -> bool { ... }
}Expand description
search in the haystack
return index of the haystack, if it found the needle. Otherwise return None.
Required Methods§
Sourcefn search_in(&self, haystack: &'a str) -> Option<usize>
fn search_in(&self, haystack: &'a str) -> Option<usize>
search self in the haystack.
return index of the haystack, if it found self. Otherwise return None.
Sourcefn rsearch_in(&self, haystack: &'a str) -> Option<usize>
fn rsearch_in(&self, haystack: &'a str) -> Option<usize>
reverse search self in the haystack.
return index of the haystack, if it found self. Otherwise return None.
Sourcefn search_in_ignore_ascii_case(&self, haystack: &'a str) -> Option<usize>
fn search_in_ignore_ascii_case(&self, haystack: &'a str) -> Option<usize>
search self in the haystack, ignore ascii case.
return index of the haystack, if it found self. Otherwise return None.
Sourcefn rsearch_in_ignore_ascii_case(&self, haystack: &'a str) -> Option<usize>
fn rsearch_in_ignore_ascii_case(&self, haystack: &'a str) -> Option<usize>
reverse search self in the haystack, ignore ascii case.
return index of the haystack, if it found self. Otherwise return None.
Provided Methods§
Sourcefn includes_in(&self, haystack: &'a str) -> bool
fn includes_in(&self, haystack: &'a str) -> bool
includes self in the haystack.
returns true if the given pattern matches a sub-slice of this string slice. returns false if it does not.
Sourcefn includes_in_ignore_ascii_case(&self, haystack: &'a str) -> bool
fn includes_in_ignore_ascii_case(&self, haystack: &'a str) -> bool
includes self in the haystack, ignore ascii case.
returns true if the given pattern matches a sub-slice of this string slice. returns false if it does not.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.