You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
&str has find_str(). It would be handy to have such a method for slices as well. This is for example useful for work with non-utf8 based strings.
A simple implementation for std::slice::ImmutableEqVector could be:
/// Returns the index of the first matching subslice
fn find_slice<T: PartialEq>(&self, needle: &[T]) -> Option<uint> {
for i in range(0, this.len()) {
if this.slice_from(i).starts_with(needle) {
return Some(i)
}
}
None
}
If desired I could file a pull request.
The text was updated successfully, but these errors were encountered:
…mment, r=lnicola
Try to update parser/event doc
`TokenSource` and `TreeSink` has been refactored as part of rust-lang#10765, they no longer exist in code repo. This pr tries to remove them from event module level comment to prevent confusion.
&str has find_str(). It would be handy to have such a method for slices as well. This is for example useful for work with non-utf8 based strings.
A simple implementation for
std::slice::ImmutableEqVector
could be:If desired I could file a pull request.
The text was updated successfully, but these errors were encountered: