Use stable rust

This commit is contained in:
Andras Schmelczer 2026-03-11 21:07:23 +00:00
parent 31993762de
commit c2144a2634
18 changed files with 118 additions and 44 deletions

View file

@ -30,7 +30,9 @@ where
/// 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) }
fn from(text: &str) -> Self {
Token::new(text.to_owned(), text.to_owned(), true, true)
}
}
impl<T> Token<T>
@ -51,18 +53,28 @@ where
}
}
pub fn original(&self) -> &str { &self.original }
pub fn original(&self) -> &str {
&self.original
}
pub fn set_normalized(&mut self, normalized: T) { self.normalized = normalized; }
pub fn set_normalized(&mut self, normalized: T) {
self.normalized = normalized;
}
pub fn normalized(&self) -> &T { &self.normalized }
pub fn normalized(&self) -> &T {
&self.normalized
}
pub fn get_original_length(&self) -> usize { self.original.chars().count() }
pub fn get_original_length(&self) -> usize {
self.original.chars().count()
}
}
impl<T> PartialEq for Token<T>
where
T: PartialEq + Clone + Debug,
{
fn eq(&self, other: &Self) -> bool { self.normalized == other.normalized }
fn eq(&self, other: &Self) -> bool {
self.normalized == other.normalized
}
}