@@ -69,7 +69,7 @@ use crate::slice::memchr;
69
69
/// |--------------------------|-------------------------------------------|
70
70
/// | `&str` | is substring |
71
71
/// | `char` | is contained in string |
72
- /// | `&[char] | any char in slice is contained in string |
72
+ /// | `&[char]` | any char in slice is contained in string |
73
73
/// | `F: FnMut(char) -> bool` | `F` returns `true` for a char in string |
74
74
/// | `&&str` | is substring |
75
75
/// | `&String` | is substring |
@@ -117,6 +117,15 @@ pub trait Pattern<'a>: Sized {
117
117
matches ! ( self . into_searcher( haystack) . next( ) , SearchStep :: Match ( 0 , _) )
118
118
}
119
119
120
+ /// Checks whether the pattern matches at the back of the haystack
121
+ #[ inline]
122
+ fn is_suffix_of ( self , haystack : & ' a str ) -> bool
123
+ where
124
+ Self :: Searcher : ReverseSearcher < ' a > ,
125
+ {
126
+ matches ! ( self . into_searcher( haystack) . next_back( ) , SearchStep :: Match ( _, j) if haystack. len( ) == j)
127
+ }
128
+
120
129
/// Removes the pattern from the front of haystack, if it matches.
121
130
#[ inline]
122
131
fn strip_prefix_of ( self , haystack : & ' a str ) -> Option < & ' a str > {
@@ -133,15 +142,6 @@ pub trait Pattern<'a>: Sized {
133
142
}
134
143
}
135
144
136
- /// Checks whether the pattern matches at the back of the haystack
137
- #[ inline]
138
- fn is_suffix_of ( self , haystack : & ' a str ) -> bool
139
- where
140
- Self :: Searcher : ReverseSearcher < ' a > ,
141
- {
142
- matches ! ( self . into_searcher( haystack) . next_back( ) , SearchStep :: Match ( _, j) if haystack. len( ) == j)
143
- }
144
-
145
145
/// Removes the pattern from the back of haystack, if it matches.
146
146
#[ inline]
147
147
fn strip_suffix_of ( self , haystack : & ' a str ) -> Option < & ' a str >
0 commit comments