pub struct Edit { /* private fields */ }Expand description
A text edit to be applied to a source file. Inserts, deletes, or replaces content at a given location.
Implementations§
Source§impl Edit
impl Edit
Sourcepub const fn deletion(start: TextSize, end: TextSize) -> Self
pub const fn deletion(start: TextSize, end: TextSize) -> Self
Creates an edit that deletes the content in the start to end range.
Sourcepub const fn range_deletion(range: TextRange) -> Self
pub const fn range_deletion(range: TextRange) -> Self
Creates an edit that deletes the content in range.
Sourcepub fn replacement(content: String, start: TextSize, end: TextSize) -> Self
pub fn replacement(content: String, start: TextSize, end: TextSize) -> Self
Creates an edit that replaces the content in the start to end range with content.
Sourcepub fn range_replacement(content: String, range: TextRange) -> Self
pub fn range_replacement(content: String, range: TextRange) -> Self
Creates an edit that replaces the content in range with content.
Sourcepub fn insertion(content: String, at: TextSize) -> Self
pub fn insertion(content: String, at: TextSize) -> Self
Creates an edit that inserts content at the TextSize at.
pub fn into_content(self) -> Option<Box<str>>
Sourcepub fn is_deletion(&self) -> bool
pub fn is_deletion(&self) -> bool
Returns true if this edit deletes content from the source document.
Sourcepub fn is_insertion(&self) -> bool
pub fn is_insertion(&self) -> bool
Returns true if this edit inserts new content into the source document.
Sourcepub fn is_replacement(&self) -> bool
pub fn is_replacement(&self) -> bool
Returns true if this edit replaces some existing content with new content.
Trait Implementations§
impl Eq for Edit
Source§impl GetSize for Edit
impl GetSize for Edit
Source§fn get_heap_size(&self) -> usize
fn get_heap_size(&self) -> usize
Determines how many bytes this object occupies inside the heap. Read more
Source§fn get_heap_size_with_tracker<TRACKER: GetSizeTracker>(
&self,
tracker: TRACKER,
) -> (usize, TRACKER)
fn get_heap_size_with_tracker<TRACKER: GetSizeTracker>( &self, tracker: TRACKER, ) -> (usize, TRACKER)
Determines how many bytes this object occupies inside the heap while using a
tracker. Read moreSource§fn get_stack_size() -> usize
fn get_stack_size() -> usize
Determines how may bytes this object occupies inside the stack. Read more
Source§fn get_size_with_tracker<T>(&self, tracker: T) -> (usize, T)where
T: GetSizeTracker,
fn get_size_with_tracker<T>(&self, tracker: T) -> (usize, T)where
T: GetSizeTracker,
Determines the total size of the object while using a
tracker. Read moreSource§impl Ord for Edit
impl Ord for Edit
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Edit
impl PartialOrd for Edit
impl StructuralPartialEq for Edit
Auto Trait Implementations§
impl Freeze for Edit
impl RefUnwindSafe for Edit
impl Send for Edit
impl Sync for Edit
impl Unpin for Edit
impl UnsafeUnpin for Edit
impl UnwindSafe for Edit
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.