pub struct Myers<T = u64>where
T: BitVec,{ /* private fields */ }
Expand description
Myers algorithm.
Implementations§
source§impl<T: BitVec> Myers<T>
impl<T: BitVec> Myers<T>
sourcepub fn distance<C, I>(&self, text: I) -> usizewhere
C: Borrow<u8>,
I: IntoIterator<Item = C>,
pub fn distance<C, I>(&self, text: I) -> usizewhere C: Borrow<u8>, I: IntoIterator<Item = C>,
Calculate the global distance of the pattern to the given text.
sourcepub fn find_all_end<C, I>(
&self,
text: I,
max_dist: usize
) -> Matches<'_, T, C, I::IntoIter> ⓘwhere
C: Borrow<u8>,
I: IntoIterator<Item = C>,
pub fn find_all_end<C, I>( &self, text: I, max_dist: usize ) -> Matches<'_, T, C, I::IntoIter> ⓘwhere C: Borrow<u8>, I: IntoIterator<Item = C>,
Finds all matches of pattern in the given text up to a given maximum distance. Matches are returned as an iterator over pairs of end position and distance.
sourcepub fn find_best_end<C, I>(&self, text: I) -> (usize, usize)where
C: Borrow<u8>,
I: IntoIterator<Item = C>,
pub fn find_best_end<C, I>(&self, text: I) -> (usize, usize)where C: Borrow<u8>, I: IntoIterator<Item = C>,
Find the best match of the pattern in the given text. if multiple end positions have the same distance, the first is returned.
sourcepub fn find_all<C, I>(
&mut self,
text: I,
max_dist: usize
) -> FullMatches<'_, T, C, I::IntoIter> ⓘwhere
C: Borrow<u8>,
I: IntoIterator<Item = C>,
I::IntoIter: ExactSizeIterator,
pub fn find_all<C, I>( &mut self, text: I, max_dist: usize ) -> FullMatches<'_, T, C, I::IntoIter> ⓘwhere C: Borrow<u8>, I: IntoIterator<Item = C>, I::IntoIter: ExactSizeIterator,
Finds all matches of pattern in the given text up to a given maximum distance.
In contrast to find_all_end
, matches are returned as an iterator over ranges
of (start, end, distance)
. Note that the end coordinate is not included in the
range and thus and thus greater by one compared to the end index returned by
find_all_end()
.
sourcepub fn find_all_lazy<C, I>(
&mut self,
text: I,
max_dist: usize
) -> LazyMatches<'_, T, C, I::IntoIter> ⓘwhere
C: Borrow<u8>,
I: IntoIterator<Item = C>,
I::IntoIter: ExactSizeIterator,
pub fn find_all_lazy<C, I>( &mut self, text: I, max_dist: usize ) -> LazyMatches<'_, T, C, I::IntoIter> ⓘwhere C: Borrow<u8>, I: IntoIterator<Item = C>, I::IntoIter: ExactSizeIterator,
As find_all_end
, this function returns an iterator over tuples of (end, distance)
.
Additionally, it keeps the data necessary for later obtaining the starting positions and/or
the alignment path at any position that was already searched.
Trait Implementations§
source§impl<T> Ord for Myers<T>where
T: BitVec + Ord,
impl<T> Ord for Myers<T>where T: BitVec + Ord,
source§impl<T> PartialEq<Myers<T>> for Myers<T>where
T: BitVec + PartialEq,
impl<T> PartialEq<Myers<T>> for Myers<T>where T: BitVec + PartialEq,
source§impl<T> PartialOrd<Myers<T>> for Myers<T>where
T: BitVec + PartialOrd,
impl<T> PartialOrd<Myers<T>> for Myers<T>where T: BitVec + PartialOrd,
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl<T> Eq for Myers<T>where T: BitVec + Eq,
impl<T> StructuralEq for Myers<T>where T: BitVec,
impl<T> StructuralPartialEq for Myers<T>where T: BitVec,
Auto Trait Implementations§
impl<T> RefUnwindSafe for Myers<T>where T: RefUnwindSafe,
impl<T> Send for Myers<T>where T: Send,
impl<T> Sync for Myers<T>where T: Sync,
impl<T> Unpin for Myers<T>where T: Unpin,
impl<T> UnwindSafe for Myers<T>where T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.