Skip to content

Commit f6dcaee

Browse files
committed
Auto merge of #111922 - vaporoxx:feat-searcher, r=dtolnay
feat: implement `DoubleEndedSearcher` for `CharArray[Ref]Searcher` This PR implements `DoubleEndedSearcher` for both `CharArraySearcher` and `CharArrayRefSearcher`. I'm not sure whether this was just overlooked or if there is a reason for it, but since it behaves exactly like `CharSliceSearcher`, I think the implementations should be appropriate.
2 parents e886137 + c6ed532 commit f6dcaee

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

library/core/src/str/pattern.rs

+4
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,8 @@ unsafe impl<'a, const N: usize> ReverseSearcher<'a> for CharArraySearcher<'a, N>
806806
searcher_methods!(reverse);
807807
}
808808

809+
impl<'a, const N: usize> DoubleEndedSearcher<'a> for CharArraySearcher<'a, N> {}
810+
809811
/// Searches for chars that are equal to any of the [`char`]s in the array.
810812
///
811813
/// # Examples
@@ -826,6 +828,8 @@ unsafe impl<'a, 'b, const N: usize> ReverseSearcher<'a> for CharArrayRefSearcher
826828
searcher_methods!(reverse);
827829
}
828830

831+
impl<'a, 'b, const N: usize> DoubleEndedSearcher<'a> for CharArrayRefSearcher<'a, 'b, N> {}
832+
829833
/////////////////////////////////////////////////////////////////////////////
830834
// Impl for &[char]
831835
/////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)