[−][src]Struct ra_ap_test_utils::__Changeset
The information about a full changeset
Fields
diffs: Vec<Difference>
An ordered vector of Difference
objects, coresponding
to the differences within the text
split: String
The split used when creating the Changeset
Common splits are ""
for char-level, " "
for word-level and "\n"
for line-level.
distance: i32
The edit distance of the Changeset
Implementations
impl Changeset
[src]
pub fn new(orig: &str, edit: &str, split: &str) -> Changeset
[src]
Calculates the edit distance and the changeset for two given strings. The first string is assumed to be the "original", the second to be an edited version of the first. The third parameter specifies how to split the input strings, leading to a more or less exact comparison.
Common splits are ""
for char-level, " "
for word-level and "\n"
for line-level.
Outputs the edit distance (how much the two strings differ) and a "changeset", that is
a Vec
containing Difference
s.
Examples
use difference::{Changeset, Difference}; let changeset = Changeset::new("test", "tent", ""); assert_eq!(changeset.diffs, vec![ Difference::Same("te".to_string()), Difference::Rem("s".to_string()), Difference::Add("n".to_string()), Difference::Same("t".to_string()) ]);
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Changeset
impl Send for Changeset
impl Sync for Changeset
impl Unpin for Changeset
impl UnwindSafe for Changeset
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,