Add example

This commit is contained in:
Dima Kudosh
2016-02-28 22:33:35 +03:00
parent a99af75280
commit 208671babd
3 changed files with 64 additions and 1 deletions
+13
View File
@@ -74,6 +74,19 @@ impl<'a> Sequence for Vec<&'a str> {
}
}
impl<'a> Sequence for [&'a str] {
fn len(&self) -> usize {
self.len()
}
fn at_index(&self, index: usize) -> Option<&str> {
if index < self.len() && index >= 0 {
return Some(self[index])
}
None
}
}
pub struct SequenceMatcher<'a, T: 'a + ?Sized + Sequence>{
first_sequence: &'a T,
second_sequence: &'a T,