pub struct DocumentChange {
pub range: TextRange,
pub new_text: String,
pub old_text: String,
}Expand description
A single text edit: replace range in the source with new_text.
old_text records the bytes that were replaced so the change can be
inverted (undone).
Fields§
§range: TextRangeThe byte range that is replaced.
new_text: StringThe text that replaces range.
old_text: StringThe original text at range (used for undo).
Implementations§
Source§impl DocumentChange
impl DocumentChange
Sourcepub fn new(
range: TextRange,
new_text: impl Into<String>,
old_text: impl Into<String>,
) -> Self
pub fn new( range: TextRange, new_text: impl Into<String>, old_text: impl Into<String>, ) -> Self
Creates a new DocumentChange.
Trait Implementations§
Source§impl Clone for DocumentChange
impl Clone for DocumentChange
Source§fn clone(&self) -> DocumentChange
fn clone(&self) -> DocumentChange
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DocumentChange
impl RefUnwindSafe for DocumentChange
impl Send for DocumentChange
impl Sync for DocumentChange
impl Unpin for DocumentChange
impl UnsafeUnpin for DocumentChange
impl UnwindSafe for DocumentChange
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