SearchIn

Trait SearchIn 

Source
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§

Source

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.

Source

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.

Source

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.

Source

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.

Source

fn len(&self) -> usize

return the length of self

Provided Methods§

Source

fn is_empty(&self) -> bool

true if a length of 0.

Source

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.

Source

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.

Implementations on Foreign Types§

Source§

impl<'a> SearchIn<'a> for &str

Source§

fn search_in(&self, haystack: &'a str) -> Option<usize>

Source§

fn rsearch_in(&self, haystack: &'a str) -> Option<usize>

Source§

fn search_in_ignore_ascii_case(&self, haystack: &'a str) -> Option<usize>

Source§

fn rsearch_in_ignore_ascii_case(&self, haystack: &'a str) -> Option<usize>

Source§

fn len(&self) -> usize

Source§

impl<'a> SearchIn<'a> for &String

Source§

fn search_in(&self, haystack: &'a str) -> Option<usize>

Source§

fn rsearch_in(&self, haystack: &'a str) -> Option<usize>

Source§

fn search_in_ignore_ascii_case(&self, haystack: &'a str) -> Option<usize>

Source§

fn rsearch_in_ignore_ascii_case(&self, haystack: &'a str) -> Option<usize>

Source§

fn len(&self) -> usize

Source§

impl<'a> SearchIn<'a> for char

Source§

fn search_in(&self, haystack: &'a str) -> Option<usize>

Source§

fn rsearch_in(&self, haystack: &'a str) -> Option<usize>

Source§

fn search_in_ignore_ascii_case(&self, haystack: &'a str) -> Option<usize>

Source§

fn rsearch_in_ignore_ascii_case(&self, haystack: &'a str) -> Option<usize>

Source§

fn len(&self) -> usize

Implementors§