Clean up API and small fixes

This commit is contained in:
Andras Schmelczer 2026-03-10 21:35:09 +00:00
parent 665cdb2881
commit a80da338e4
13 changed files with 56 additions and 36 deletions

View file

@ -22,7 +22,7 @@ where
{
pub fn vec_from(left: &[Token<T>], right: &[Token<T>]) -> Vec<Self> { myers_diff(left, right) }
pub fn tokens(&self) -> &Vec<Token<T>> {
pub fn tokens(&self) -> &[Token<T>] {
match self {
RawOperation::Insert(tokens)
| RawOperation::Delete(tokens)
@ -34,7 +34,9 @@ where
self.tokens().iter().map(Token::get_original_length).sum()
}
pub fn get_original_text(self) -> String { self.tokens().iter().map(Token::original).collect() }
pub fn get_original_text(&self) -> String {
self.tokens().iter().map(Token::original).collect()
}
pub fn is_left_joinable(&self) -> bool {
let first_token = self.tokens().first();