瀏覽代碼

refactor: move operation to delta folder

appflowy 2 年之前
父節點
當前提交
2039cc00b5

+ 1 - 0
frontend/rust-lib/Cargo.lock

@@ -1778,6 +1778,7 @@ dependencies = [
  "md5",
  "serde",
  "serde_json",
+ "serde_repr",
  "strum",
  "strum_macros",
  "thiserror",

+ 1 - 1
shared-lib/lib-ot/src/core/delta/builder.rs

@@ -1,5 +1,5 @@
+use crate::core::delta::operation::Attributes;
 use crate::core::delta::{trim, Delta};
-use crate::core::operation::Attributes;
 use crate::core::Operation;
 
 /// A builder for creating new [Delta] objects.

+ 1 - 1
shared-lib/lib-ot/src/core/delta/cursor.rs

@@ -1,7 +1,7 @@
 #![allow(clippy::while_let_on_iterator)]
+use crate::core::delta::operation::{Attributes, Operation};
 use crate::core::delta::Delta;
 use crate::core::interval::Interval;
-use crate::core::operation::{Attributes, Operation};
 use crate::errors::{ErrorBuilder, OTError, OTErrorCode};
 use std::{cmp::min, iter::Enumerate, slice::Iter};
 

+ 1 - 1
shared-lib/lib-ot/src/core/delta/delta.rs

@@ -1,8 +1,8 @@
 use crate::errors::{ErrorBuilder, OTError, OTErrorCode};
 
+use crate::core::delta::operation::{Attributes, Operation, OperationTransform, PhantomAttributes};
 use crate::core::delta::{DeltaIterator, MAX_IV_LEN};
 use crate::core::interval::Interval;
-use crate::core::operation::{Attributes, Operation, OperationTransform, PhantomAttributes};
 use crate::core::ot_str::OTString;
 use crate::core::DeltaBuilder;
 use bytes::Bytes;

+ 1 - 1
shared-lib/lib-ot/src/core/delta/delta_serde.rs

@@ -1,5 +1,5 @@
+use crate::core::delta::operation::Attributes;
 use crate::core::delta::Delta;
-use crate::core::operation::Attributes;
 use serde::{
     de::{SeqAccess, Visitor},
     ser::SerializeSeq,

+ 1 - 1
shared-lib/lib-ot/src/core/delta/iterator.rs

@@ -1,7 +1,7 @@
 use super::cursor::*;
+use crate::core::delta::operation::{Attributes, Operation};
 use crate::core::delta::{Delta, NEW_LINE};
 use crate::core::interval::Interval;
-use crate::core::operation::{Attributes, Operation};
 use crate::rich_text::TextAttributes;
 use std::ops::{Deref, DerefMut};
 

+ 1 - 0
shared-lib/lib-ot/src/core/delta/mod.rs

@@ -4,6 +4,7 @@ mod cursor;
 mod delta;
 mod delta_serde;
 mod iterator;
+pub mod operation;
 
 pub use builder::*;
 pub use cursor::*;

+ 1 - 1
shared-lib/lib-ot/src/core/operation/builder.rs → shared-lib/lib-ot/src/core/delta/operation/builder.rs

@@ -1,4 +1,4 @@
-use crate::core::operation::{Attributes, Operation, PhantomAttributes};
+use crate::core::delta::operation::{Attributes, Operation, PhantomAttributes};
 use crate::rich_text::TextAttributes;
 
 pub type RichTextOpBuilder = OperationsBuilder<TextAttributes>;

+ 0 - 0
shared-lib/lib-ot/src/core/operation/mod.rs → shared-lib/lib-ot/src/core/delta/operation/mod.rs


+ 0 - 0
shared-lib/lib-ot/src/core/operation/operation.rs → shared-lib/lib-ot/src/core/delta/operation/operation.rs


+ 1 - 1
shared-lib/lib-ot/src/core/operation/operation_serde.rs → shared-lib/lib-ot/src/core/delta/operation/operation_serde.rs

@@ -1,4 +1,4 @@
-use crate::core::operation::{Attributes, Insert, Operation, Retain};
+use crate::core::delta::operation::{Attributes, Insert, Operation, Retain};
 use crate::core::ot_str::OTString;
 use serde::{
     de,

+ 1 - 2
shared-lib/lib-ot/src/core/mod.rs

@@ -1,11 +1,10 @@
 mod delta;
 mod document;
 mod interval;
-mod operation;
 mod ot_str;
 
+pub use delta::operation::*;
 pub use delta::*;
 pub use document::*;
 pub use interval::*;
-pub use operation::*;
 pub use ot_str::*;