Lines Matching refs:str
6 use std::str::FromStr;
21 pub fn escape(text: &str) -> String {
30 text: &'t str,
57 pub fn as_str(&self) -> &'t str {
63 fn new(haystack: &'t str, start: usize, end: usize) -> Match<'t> {
68 impl<'t> From<Match<'t>> for &'t str {
69 fn from(m: Match<'t>) -> &'t str {
112 /// # Using the `std::str::pattern` methods with `Regex`
118 /// defined on `&str`. For example, `is_match`, `find`, `find_iter`
119 /// and `split` can be replaced with `str::contains`, `str::find`,
120 /// `str::match_indices` and `str::split`.
163 fn from_str(s: &str) -> Result<Regex, Error> {
174 pub fn new(re: &str) -> Result<Regex, Error> {
197 pub fn is_match(&self, text: &str) -> bool {
222 pub fn find<'t>(&self, text: &'t str) -> Option<Match<'t>> {
244 pub fn find_iter<'r, 't>(&'r self, text: &'t str) -> Matches<'r, 't> {
305 /// method or the `Index` notation with a `&str`. Note that the named
311 pub fn captures<'t>(&self, text: &'t str) -> Option<Captures<'t>> {
347 text: &'t str,
366 /// let fields: Vec<&str> = re.split("a b \t c\td e").collect();
370 pub fn split<'r, 't>(&'r self, text: &'t str) -> Split<'r, 't> {
390 /// let fields: Vec<&str> = re.splitn("Hey! How are you?", 3).collect();
396 text: &'t str,
508 text: &'t str,
510 ) -> Cow<'t, str> {
522 text: &'t str,
524 ) -> Cow<'t, str> {
536 text: &'t str,
539 ) -> Cow<'t, str> {
614 pub fn shortest_match(&self, text: &str) -> Option<usize> {
626 text: &str,
638 pub fn is_match_at(&self, text: &str, start: usize) -> bool {
650 text: &'t str,
672 text: &'t str,
686 text: &'t str,
704 text: &'t str,
714 pub fn as_str(&self) -> &str {
754 type Item = Option<&'r str>;
756 fn next(&mut self) -> Option<Option<&'r str>> {
787 type Item = &'t str;
789 fn next(&mut self) -> Option<&'t str> {
825 type Item = &'t str;
827 fn next(&mut self) -> Option<&'t str> {
923 text: &'t str,
954 pub fn name(&self, name: &str) -> Option<Match<'t>> {
988 pub fn expand(&self, replacement: &str, dst: &mut String) {
1041 type Output = str;
1043 fn index(&self, i: usize) -> &str {
1062 impl<'t, 'i> Index<&'i str> for Captures<'t> {
1063 type Output = str;
1065 fn index<'a>(&'a self, name: &'i str) -> &'a str {
1159 /// since implementations are already provided for `&str` along with other
1161 /// `FnMut(&Captures) -> T` where `T: AsRef<str>`), which covers most use cases.
1179 fn no_expansion<'r>(&'r mut self) -> Option<Cow<'r, str>> {
1196 /// src: &str,
1219 fn no_expansion(&mut self) -> Option<Cow<'_, str>> {
1224 impl<'a> Replacer for &'a str {
1229 fn no_expansion(&mut self) -> Option<Cow<'_, str>> {
1239 fn no_expansion(&mut self) -> Option<Cow<'_, str>> {
1249 fn no_expansion(&mut self) -> Option<Cow<'_, str>> {
1254 impl<'a> Replacer for Cow<'a, str> {
1259 fn no_expansion(&mut self) -> Option<Cow<'_, str>> {
1264 impl<'a> Replacer for &'a Cow<'a, str> {
1269 fn no_expansion(&mut self) -> Option<Cow<'_, str>> {
1274 fn no_expansion<T: AsRef<str>>(t: &T) -> Option<Cow<'_, str>> {
1285 T: AsRef<str>,
1301 pub struct NoExpand<'t>(pub &'t str);
1308 fn no_expansion(&mut self) -> Option<Cow<'_, str>> {