pub struct TextInsertCmd {
pub target: WidgetId,
pub position: usize,
pub text: String,
pub metadata: CommandMetadata,
/* private fields */
}Expand description
Command to insert text at a position.
Fields§
§target: WidgetIdTarget widget.
position: usizePosition to insert at (byte offset).
text: StringText to insert.
metadata: CommandMetadataCommand metadata.
Implementations§
Source§impl TextInsertCmd
impl TextInsertCmd
Sourcepub fn new(target: WidgetId, position: usize, text: impl Into<String>) -> Self
pub fn new(target: WidgetId, position: usize, text: impl Into<String>) -> Self
Create a new text insert command.
Sourcepub fn with_apply<F>(self, f: F) -> Self
pub fn with_apply<F>(self, f: F) -> Self
Set the apply callback.
Sourcepub fn with_remove<F>(self, f: F) -> Self
pub fn with_remove<F>(self, f: F) -> Self
Set the remove callback.
Trait Implementations§
Source§impl Debug for TextInsertCmd
impl Debug for TextInsertCmd
Source§impl UndoableCmd for TextInsertCmd
impl UndoableCmd for TextInsertCmd
Source§fn execute(&mut self) -> CommandResult
fn execute(&mut self) -> CommandResult
Execute the command, applying its effect.
Source§fn undo(&mut self) -> CommandResult
fn undo(&mut self) -> CommandResult
Undo the command, reverting its effect.
Source§fn description(&self) -> &str
fn description(&self) -> &str
Human-readable description for UI display.
Source§fn size_bytes(&self) -> usize
fn size_bytes(&self) -> usize
Size of this command in bytes for memory budgeting.
Source§fn can_merge(&self, other: &dyn UndoableCmd, config: &MergeConfig) -> bool
fn can_merge(&self, other: &dyn UndoableCmd, config: &MergeConfig) -> bool
Check if this command can merge with another.
Source§fn accept_merge(&mut self, other: &dyn UndoableCmd) -> bool
fn accept_merge(&mut self, other: &dyn UndoableCmd) -> bool
Accept a merge from another command. Read more
Source§fn metadata(&self) -> &CommandMetadata
fn metadata(&self) -> &CommandMetadata
Get the command metadata.
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Downcast to mutable concrete type for merging.
Source§fn debug_name(&self) -> &'static str
fn debug_name(&self) -> &'static str
Debug description of the command.
Source§fn redo(&mut self) -> CommandResult
fn redo(&mut self) -> CommandResult
Redo the command after it was undone.
Auto Trait Implementations§
impl Freeze for TextInsertCmd
impl !RefUnwindSafe for TextInsertCmd
impl Send for TextInsertCmd
impl Sync for TextInsertCmd
impl Unpin for TextInsertCmd
impl UnsafeUnpin for TextInsertCmd
impl !UnwindSafe for TextInsertCmd
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