Change style

This commit is contained in:
Andras Schmelczer 2026-03-10 20:42:09 +00:00
parent 408ce5268f
commit deffa195b3
23 changed files with 72 additions and 76 deletions

View file

@ -54,7 +54,7 @@ where
T: PartialEq + Clone + Debug,
{
/// Create an `EditedText` from the given original and updated strings
/// using the provided tokenizer.
/// using the provided tokenizer
pub fn from_strings_with_tokenizer(
original: &'a str,
updated: &TextWithCursors,
@ -256,7 +256,7 @@ where
)
}
/// Apply the operations to the text and return the resulting text.
/// Apply the operations to the text and return the resulting text
#[must_use]
pub fn apply(&self) -> TextWithCursors {
let mut builder: StringBuilder<'_> = StringBuilder::new(self.text);
@ -355,8 +355,8 @@ where
/// This is useful for sending text diffs over the network if there's a
/// clear consensus on the original text.
///
/// Inserts are represented as strings, deletes as negative integers,
/// and equal spans as positive integers.
/// Inserts are strings, deletes are negative integers (character count),
/// and retained spans are positive integers (character count).
///
/// # Panics
///

View file

@ -11,7 +11,7 @@ use crate::{
},
};
/// Represents a change that can be applied on a `StringBuilder`.
/// Represents a change that can be applied on a `StringBuilder`
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Clone, PartialEq)]
pub enum Operation<T>
@ -47,7 +47,7 @@ where
T: PartialEq + Clone + Debug,
{
/// Creates an equal (retain) operation starting at the given character
/// offset in the original text.
/// offset in the original text
pub fn create_equal(order: usize, length: usize) -> Self {
Operation::Equal {
order,
@ -69,13 +69,13 @@ where
}
/// Creates an insert operation at the given character offset with the
/// given tokens.
/// given tokens
pub fn create_insert(order: usize, text: Vec<Token<T>>) -> Self {
Operation::Insert { order, text }
}
/// Creates a delete operation at the given character offset for the
/// specified number of characters.
/// specified number of characters
pub fn create_delete(order: usize, deleted_character_count: usize) -> Self {
Operation::Delete {
order,

View file

@ -3,7 +3,7 @@ use std::fmt::Debug;
use crate::{operation_transformation::Operation, raw_operation::RawOperation};
/// Turn raw operations into ordered operations while keeping track of the
/// original token's indexes.
/// original token's indexes
pub fn cook_operations<I, T>(raw_operations: I) -> impl Iterator<Item = Operation<T>>
where
I: IntoIterator<Item = RawOperation<T>>,