pub struct TextChange {
pub range: Range<usize>,
pub new_text: String,
}Expand description
A text change applied to the source
Fields§
§range: Range<usize>§new_text: StringImplementations§
Source§impl TextChange
impl TextChange
pub fn new(start: usize, end: usize, new_text: impl Into<String>) -> Self
pub fn insertion(at: usize, text: impl Into<String>) -> Self
pub fn deletion(start: usize, end: usize) -> Self
pub fn replacement(start: usize, end: usize, text: impl Into<String>) -> Self
pub fn apply(&self, source: &str) -> String
pub fn delta(&self) -> i64
pub fn is_insertion(&self) -> bool
pub fn is_deletion(&self) -> bool
pub fn is_replacement(&self) -> bool
Trait Implementations§
Source§impl Clone for TextChange
impl Clone for TextChange
Source§fn clone(&self) -> TextChange
fn clone(&self) -> TextChange
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 moreAuto Trait Implementations§
impl Freeze for TextChange
impl RefUnwindSafe for TextChange
impl Send for TextChange
impl Sync for TextChange
impl Unpin for TextChange
impl UnsafeUnpin for TextChange
impl UnwindSafe for TextChange
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