Add example
This commit is contained in:
+1
-1
@@ -77,7 +77,7 @@ impl Differ{
|
||||
let mut eqi: Option<usize> = None;
|
||||
let mut eqj: Option<usize> = None;
|
||||
for j in second_start..second_end{
|
||||
second_sequence_str = second_sequence.at_index(j).unwrap(); // Fix in feature
|
||||
second_sequence_str = second_sequence.at_index(j).unwrap();
|
||||
for i in first_start..first_end{
|
||||
first_sequence_str = first_sequence.at_index(i).unwrap();
|
||||
if first_sequence_str == second_sequence_str{
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user