pub struct Change<'h, S = &'h str> { /* private fields */ }Expand description
A change in a buffer, with a start, taken text, and added text.
Implementations§
Source§impl Change<'static, String>
impl Change<'static, String>
Source§impl<'h> Change<'h>
impl<'h> Change<'h>
Sourcepub fn to_string_change(&self) -> Change<'static, String>
pub fn to_string_change(&self) -> Change<'static, String>
Creates a Change<String> from a Change<&str>.
Source§impl<'s, S> Change<'s, S>
impl<'s, S> Change<'s, S>
Sourcepub fn line_range(&self, strs: &Strs) -> Range<Point> ⓘ
pub fn line_range(&self, strs: &Strs) -> Range<Point> ⓘ
Gets a Range<Point>, from the start to the end of the
affected lines.
For example, if you make an edit that transforms lines 1..=3
to lines 1..=5, this function will return a Range that
starts at the beginning of line 1, and ends at the end of line
5.
§Note
This end of this range will come after the last \n,
which means that, in that example, said point would have a
Point::line value equal to 6, not 5, since it
represents both the end of line 5, and the beginning of line
6.
Sourcepub fn taken_byte_col(&self, strs: &Strs) -> usize
pub fn taken_byte_col(&self, strs: &Strs) -> usize
The ending byte column before this Change took place.
You shouldn’t call change.end_point().byte_col(strs) because
that will calculate the byte column with the new state of the
Text, when you should be doing so with the old state.
This function does that for you.
Sourcepub fn taken_char_col(&self, strs: &Strs) -> usize
pub fn taken_char_col(&self, strs: &Strs) -> usize
The ending char column before thiss Change took place.
You shouldn’t call change.end_point().char_col(strs) because
that will calculate the byte column with the new state of the
Text, when you should be doing so with the old state.
This function does that for you.
Trait Implementations§
Source§impl<'de, Context> BorrowDecode<'de, Context> for Change<'static, String>
impl<'de, Context> BorrowDecode<'de, Context> for Change<'static, String>
Source§fn borrow_decode<D>(
decoder: &mut D,
) -> Result<Change<'static, String>, DecodeError>where
D: BorrowDecoder<'de, Context = Context>,
fn borrow_decode<D>(
decoder: &mut D,
) -> Result<Change<'static, String>, DecodeError>where
D: BorrowDecoder<'de, Context = Context>,
Source§impl<'h, S> Ord for Change<'h, S>where
S: Ord,
impl<'h, S> Ord for Change<'h, S>where
S: Ord,
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<'h, S> PartialOrd for Change<'h, S>where
S: PartialOrd,
impl<'h, S> PartialOrd for Change<'h, S>where
S: PartialOrd,
impl<'h, S> Copy for Change<'h, S>where
S: Copy,
impl<'h, S> Eq for Change<'h, S>where
S: Eq,
impl<'h, S> StructuralPartialEq for Change<'h, S>
Auto Trait Implementations§
impl<'h, S> Freeze for Change<'h, S>where
S: Freeze,
impl<'h, S> RefUnwindSafe for Change<'h, S>where
S: RefUnwindSafe,
impl<'h, S> Send for Change<'h, S>where
S: Send,
impl<'h, S> Sync for Change<'h, S>where
S: Sync,
impl<'h, S> Unpin for Change<'h, S>where
S: Unpin,
impl<'h, S> UnsafeUnpin for Change<'h, S>where
S: UnsafeUnpin,
impl<'h, S> UnwindSafe for Change<'h, S>where
S: UnwindSafe,
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
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.