pub struct DistanceWorkspace { /* private fields */ }Expand description
Reusable buffers for repeated lattice distance computations.
The plain convenience functions allocate temporary buffers for each call. Use this workspace when scoring many lattice pairs, such as inside a candidate matrix, to reuse the DP and threshold-search allocations while preserving the same exact results.
Implementations§
Source§impl DistanceWorkspace
impl DistanceWorkspace
Sourcepub fn try_distance(
&mut self,
left: &Lattice,
right: &Lattice,
) -> Result<usize, DistanceError>
pub fn try_distance( &mut self, left: &Lattice, right: &Lattice, ) -> Result<usize, DistanceError>
Computes lattice edit distance using this workspace.
Sourcepub fn try_distance_with_cutoff(
&mut self,
left: &Lattice,
right: &Lattice,
threshold: usize,
) -> Result<Option<usize>, DistanceError>
pub fn try_distance_with_cutoff( &mut self, left: &Lattice, right: &Lattice, threshold: usize, ) -> Result<Option<usize>, DistanceError>
Computes lattice edit distance up to threshold using this workspace.
Sourcepub fn try_damerau_distance(
&mut self,
left: &Lattice,
right: &Lattice,
) -> Result<usize, DistanceError>
pub fn try_damerau_distance( &mut self, left: &Lattice, right: &Lattice, ) -> Result<usize, DistanceError>
Computes lattice Damerau-Levenshtein distance using this workspace.
Sourcepub fn try_damerau_distance_with_cutoff(
&mut self,
left: &Lattice,
right: &Lattice,
threshold: usize,
) -> Result<Option<usize>, DistanceError>
pub fn try_damerau_distance_with_cutoff( &mut self, left: &Lattice, right: &Lattice, threshold: usize, ) -> Result<Option<usize>, DistanceError>
Computes lattice Damerau-Levenshtein distance up to threshold using
this workspace.
Trait Implementations§
Source§impl Debug for DistanceWorkspace
impl Debug for DistanceWorkspace
Source§impl Default for DistanceWorkspace
impl Default for DistanceWorkspace
Source§fn default() -> DistanceWorkspace
fn default() -> DistanceWorkspace
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DistanceWorkspace
impl RefUnwindSafe for DistanceWorkspace
impl Send for DistanceWorkspace
impl Sync for DistanceWorkspace
impl Unpin for DistanceWorkspace
impl UnsafeUnpin for DistanceWorkspace
impl UnwindSafe for DistanceWorkspace
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
Mutably borrows from an owned value. Read more