pub struct Change<'s, S = &'s 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<'a> Change<'a>
impl<'a> Change<'a>
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>
Sourcepub fn str_insert(added_str: &'a str, start: Point) -> Self
pub fn str_insert(added_str: &'a str, start: Point) -> Self
Returns a new copyable Change from an insertion.
Source§impl<'s, S: Borrow<str>> Change<'s, S>
impl<'s, S: Borrow<str>> Change<'s, S>
Sourcepub fn line_range(&self, bytes: &Bytes) -> Range<Point>
pub fn line_range(&self, bytes: &Bytes) -> 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 aPoint::linevalue equal to 6, not 5, since it represents both the end of line 5, and the beginning of line 6.
Sourcepub fn taken_range(&self) -> Range<Point>
pub fn taken_range(&self) -> Range<Point>
Returns the taken Range
Sourcepub fn added_range(&self) -> Range<Point>
pub fn added_range(&self) -> Range<Point>
Returns the added Range
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: BorrowDecoder<'de, Context = Context>>(
decoder: &mut D,
) -> Result<Self, DecodeError>
fn borrow_decode<D: BorrowDecoder<'de, Context = Context>>( decoder: &mut D, ) -> Result<Self, DecodeError>
Attempt to decode this type with the given BorrowDecode.
Source§impl<'s, S: Ord> Ord for Change<'s, S>
impl<'s, S: Ord> Ord for Change<'s, S>
1.21.0 · 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
Source§impl<'s, S: PartialOrd> PartialOrd for Change<'s, S>
impl<'s, S: PartialOrd> PartialOrd for Change<'s, S>
impl<'s, S: Copy> Copy for Change<'s, S>
impl<'s, S: Eq> Eq for Change<'s, S>
impl<'s, S> StructuralPartialEq for Change<'s, S>
Auto Trait Implementations§
impl<'s, S> Freeze for Change<'s, S>where
S: Freeze,
impl<'s, S> RefUnwindSafe for Change<'s, S>where
S: RefUnwindSafe,
impl<'s, S> Send for Change<'s, S>where
S: Send,
impl<'s, S> Sync for Change<'s, S>where
S: Sync,
impl<'s, S> Unpin for Change<'s, S>where
S: Unpin,
impl<'s, S> UnwindSafe for Change<'s, 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
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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§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.