Skip to main content

ass_editor/commands/delta_commands/
mod.rs

1//! Delta-aware commands for incremental ASS editing
2//!
3//! Commands that use ass-core's Delta tracking for optimal performance
4
5mod batch;
6mod event_edit;
7mod insert;
8mod replace;
9
10#[cfg(test)]
11mod tests;
12
13pub use batch::DeltaBatchCommand;
14pub use event_edit::IncrementalEventEditCommand;
15pub use insert::IncrementalInsertCommand;
16pub use replace::IncrementalReplaceCommand;
17
18use super::CommandResult;
19use crate::core::{EditorDocument, Result};
20
21#[cfg(not(feature = "std"))]
22use alloc::string::String;
23
24/// A command that tracks deltas for incremental updates
25pub trait DeltaCommand {
26    /// Execute the command and return the result with delta information
27    fn execute_with_delta(&self, document: &mut EditorDocument) -> Result<super::CommandResult>;
28
29    /// Get command description for history
30    fn description(&self) -> String;
31
32    /// Check if this command can be executed incrementally
33    fn supports_incremental(&self) -> bool {
34        cfg!(feature = "stream")
35    }
36}