StrPattern

Trait StrPattern 

Source
pub trait StrPattern {
    // Required method
    fn find_in(&self, haystack: &str) -> Option<(usize, usize)>;
}
Expand description

自定义 Pattern trait,用于支持 char 和 &str 作为分隔符 实现零成本抽象,编译时单态化

Required Methods§

Source

fn find_in(&self, haystack: &str) -> Option<(usize, usize)>

在字符串中查找模式,返回匹配位置和模式长度

Implementations on Foreign Types§

Source§

impl StrPattern for &str

Source§

fn find_in(&self, haystack: &str) -> Option<(usize, usize)>

Source§

impl StrPattern for &String

Source§

fn find_in(&self, haystack: &str) -> Option<(usize, usize)>

Source§

impl StrPattern for char

Source§

fn find_in(&self, haystack: &str) -> Option<(usize, usize)>

Source§

impl StrPattern for String

Source§

fn find_in(&self, haystack: &str) -> Option<(usize, usize)>

Implementors§