Formatting and typos
This commit is contained in:
parent
56e08588ef
commit
75835ac9a3
5 changed files with 23 additions and 22 deletions
|
|
@ -3,9 +3,9 @@ use std::fmt::Debug;
|
|||
#[cfg(feature = "serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// A token is a string that has been normalised in some way.
|
||||
/// A token is a string that has been normalized in some way.
|
||||
///
|
||||
/// A token consists of the normalised form is used for comparison, and the
|
||||
/// A token consists of the normalized form is used for comparison, and the
|
||||
/// original form used for subsequently applying `Operation`-s to a text
|
||||
/// document.
|
||||
///
|
||||
|
|
@ -16,8 +16,8 @@ pub struct Token<T>
|
|||
where
|
||||
T: PartialEq + Clone + Debug,
|
||||
{
|
||||
/// The normalised form of the token used deriving the diff.
|
||||
normalised: T,
|
||||
/// The normalized form of the token used deriving the diff.
|
||||
normalized: T,
|
||||
|
||||
/// The original string, that should be inserted or deleted in the document.
|
||||
original: String,
|
||||
|
|
@ -29,7 +29,7 @@ where
|
|||
pub is_right_joinable: bool,
|
||||
}
|
||||
|
||||
/// Trivial implementation of Token when the normalised form is the same as the
|
||||
/// Trivial implementation of Token when the normalized form is the same as the
|
||||
/// original string.
|
||||
impl From<&str> for Token<String> {
|
||||
fn from(text: &str) -> Self { Token::new(text.to_owned(), text.to_owned(), true, true) }
|
||||
|
|
@ -40,13 +40,13 @@ where
|
|||
T: PartialEq + Clone + Debug,
|
||||
{
|
||||
pub fn new(
|
||||
normalised: T,
|
||||
normalized: T,
|
||||
original: String,
|
||||
is_left_joinable: bool,
|
||||
is_right_joinable: bool,
|
||||
) -> Self {
|
||||
Token {
|
||||
normalised,
|
||||
normalized,
|
||||
original,
|
||||
is_left_joinable,
|
||||
is_right_joinable,
|
||||
|
|
@ -55,9 +55,9 @@ where
|
|||
|
||||
pub fn original(&self) -> &str { &self.original }
|
||||
|
||||
pub fn set_normalised(&mut self, normalised: T) { self.normalised = normalised; }
|
||||
pub fn set_normalized(&mut self, normalized: T) { self.normalized = normalized; }
|
||||
|
||||
pub fn normalised(&self) -> &T { &self.normalised }
|
||||
pub fn normalized(&self) -> &T { &self.normalized }
|
||||
|
||||
pub fn get_original_length(&self) -> usize { self.original.chars().count() }
|
||||
}
|
||||
|
|
@ -66,5 +66,5 @@ impl<T> PartialEq for Token<T>
|
|||
where
|
||||
T: PartialEq + Clone + Debug,
|
||||
{
|
||||
fn eq(&self, other: &Self) -> bool { self.normalised == other.normalised }
|
||||
fn eq(&self, other: &Self) -> bool { self.normalized == other.normalized }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue