Rename file

This commit is contained in:
Andras Schmelczer 2025-11-15 16:56:32 +00:00
parent 830b17dc1f
commit c0aacc06d9
3 changed files with 7 additions and 22 deletions

View file

@ -1,6 +1,5 @@
mod edited_text;
mod operation;
mod transport;
mod utils;
use std::fmt::Debug;

View file

@ -1,3 +1,4 @@
pub mod change_set;
pub mod cursor_position;
pub mod history;
pub mod side;

View file

@ -6,11 +6,15 @@ use serde::{
de::{self, Deserializer, Visitor},
ser::Serializer,
};
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;
use crate::{CursorPosition, Tokenizer, operation_transformation::Operation};
use crate::{Tokenizer, operation_transformation::Operation};
/// A serializable representation of the changes made to a text document
/// without the original text.
#[derive(Clone, PartialEq, Eq, Debug)]
pub enum SimpleOperation {
enum SimpleOperation {
Equal { length: usize },
Insert { text: String },
Delete { length: usize },
@ -183,22 +187,3 @@ impl<'de> Deserialize<'de> for SimpleOperation {
deserializer.deserialize_any(OperationVisitor)
}
}
/// A serializable representation of the changes made to a text document
/// without the original text.
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq, Default)]
pub struct ChangeSet {
pub operations: Vec<SimpleOperation>,
pub cursors: Vec<CursorPosition>,
}
impl ChangeSet {
#[must_use]
pub fn new(operations: Vec<SimpleOperation>, cursors: Vec<CursorPosition>) -> Self {
Self {
operations,
cursors,
}
}
}