pub struct Edit {
pub range: Range<usize>,
pub insert: String,
}Expand description
A single contiguous text edit: replace range (a byte range in the old
text) with insert.
Fields§
§range: Range<usize>§insert: StringImplementations§
Source§impl Edit
impl Edit
Sourcepub fn apply(&self, old: &str) -> String
pub fn apply(&self, old: &str) -> String
Apply the edit to old, producing the new text.
Panics when range is not a slice old can take. Callers holding an
edit they did not compute themselves want Edit::produces or
edits_produce instead, which decide the same question without
building the result and without panicking.
Trait Implementations§
impl Eq 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