pub struct InsertTextCommand {
pub position: Position,
pub text: String,
pub description: Option<String>,
}
Expand description
Text insertion command
Fields§
§position: Position
Position to insert text at
text: String
Text to insert
description: Option<String>
Optional description override
Implementations§
Source§impl InsertTextCommand
impl InsertTextCommand
Sourcepub fn new(position: Position, text: String) -> Self
pub fn new(position: Position, text: String) -> Self
Create a new insert text command
§Examples
use ass_editor::{InsertTextCommand, EditorDocument, Position, EditorCommand};
let mut doc = EditorDocument::new();
let command = InsertTextCommand::new(Position::new(0), "Hello World".to_string());
let result = command.execute(&mut doc).unwrap();
assert!(result.success);
assert_eq!(doc.text(), "Hello World");
Sourcepub fn with_description(self, description: String) -> Self
pub fn with_description(self, description: String) -> Self
Set a custom description for this command
Trait Implementations§
Source§impl Clone for InsertTextCommand
impl Clone for InsertTextCommand
Source§fn clone(&self) -> InsertTextCommand
fn clone(&self) -> InsertTextCommand
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for InsertTextCommand
impl Debug for InsertTextCommand
Source§impl EditorCommand for InsertTextCommand
impl EditorCommand for InsertTextCommand
Source§fn execute(&self, document: &mut EditorDocument) -> Result<CommandResult>
fn execute(&self, document: &mut EditorDocument) -> Result<CommandResult>
Execute the command on the given document Read more
Source§fn description(&self) -> &str
fn description(&self) -> &str
Get a human-readable description of the command
Source§fn memory_usage(&self) -> usize
fn memory_usage(&self) -> usize
Get the estimated memory usage of this command Read more
Source§fn modifies_content(&self) -> bool
fn modifies_content(&self) -> bool
Check if this command modifies document content Read more
Source§impl PartialEq for InsertTextCommand
impl PartialEq for InsertTextCommand
impl Eq for InsertTextCommand
impl StructuralPartialEq for InsertTextCommand
Auto Trait Implementations§
impl Freeze for InsertTextCommand
impl RefUnwindSafe for InsertTextCommand
impl Send for InsertTextCommand
impl Sync for InsertTextCommand
impl Unpin for InsertTextCommand
impl UnwindSafe for InsertTextCommand
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