pub struct Results { /* private fields */ }
Expand description
A struct to hold the results of a Levenshtein distance calculation.
This struct contains the Levenshtein distance between two sequences and the sequence of operations (represented as a matrix of integers) that describe how to transform the first sequence into the second.
Implementations§
Source§impl Results
impl Results
pub fn new(distance: i32, sequence: Vec<Vec<i32>>) -> Self
Sourcepub fn distance(&self) -> i32
pub fn distance(&self) -> i32
Returns the Levenshtein distance.
This is the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one sequence into the other.
§Returns
Returns an i32
representing the Levenshtein distance.
§Examples
let results = Results::new(3, vec![vec![0, 1, 2], vec![1, 2, 3]]);
assert_eq!(results.distance(), 3);
Sourcepub fn sequence(&self) -> &Vec<Vec<i32>>
pub fn sequence(&self) -> &Vec<Vec<i32>>
Returns a reference to the sequence of operations matrix.
Each element in the matrix represents an operation code corresponding to an edit operation.
§Returns
Returns a reference to a Vec<Vec<i32>>
representing the sequence of operations.
§Examples
let results = Results::new(3, vec![vec![0, 1, 2], vec![1, 2, 3]]);
assert_eq!(results.sequence(), &vec![vec![0, 1, 2], vec![1, 2, 3]]);
Auto Trait Implementations§
impl Freeze for Results
impl RefUnwindSafe for Results
impl Send for Results
impl Sync for Results
impl Unpin for Results
impl UnwindSafe for Results
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