pub struct Transform {
pub base_doc: Arc<NodePool>,
pub steps: Vector<Arc<dyn Step>>,
pub invert_steps: Vector<Arc<dyn Step>>,
pub schema: Arc<Schema>,
/* private fields */
}Fields§
§base_doc: Arc<NodePool>原始文档状态
steps: Vector<Arc<dyn Step>>存储所有操作步骤
invert_steps: Vector<Arc<dyn Step>>存储所有反向操作步骤
schema: Arc<Schema>文档的模式定义
Implementations§
Source§impl Transform
impl Transform
pub fn new(doc: Arc<NodePool>, schema: Arc<Schema>) -> Transform
pub fn step(&mut self, step: Arc<dyn Step>) -> TransformResult<()>
Sourcepub fn doc_changed(&self) -> bool
pub fn doc_changed(&self) -> bool
检查文档是否被修改
Sourcepub fn apply_steps_batch(
&mut self,
steps: Vec<Arc<dyn Step>>,
) -> TransformResult<()>
pub fn apply_steps_batch( &mut self, steps: Vec<Arc<dyn Step>>, ) -> TransformResult<()>
批量应用步骤(优化版本)
Sourcepub fn rollback_steps(&mut self, count: usize) -> TransformResult<()>
pub fn rollback_steps(&mut self, count: usize) -> TransformResult<()>
回滚指定数量的步骤
Sourcepub fn clear_history(&mut self)
pub fn clear_history(&mut self)
清除历史记录(释放内存)
Sourcepub fn history_size(&self) -> usize
pub fn history_size(&self) -> usize
获取历史记录大小
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Transform
impl !RefUnwindSafe for Transform
impl Send for Transform
impl Sync for Transform
impl Unpin for Transform
impl !UnwindSafe for Transform
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more