pub struct DiffLine {
pub id: SharedString,
/* private fields */
}Expand description
One stable, caller-supplied logical diff row.
A context row carries the same text on both sides. A pure addition or removal carries one side. A replacement carries both different sides, so split presentation can align them without this component deciding which removal belongs with which addition.
Fields§
§id: SharedStringImplementations§
Source§impl DiffLine
impl DiffLine
Sourcepub fn new(id: impl Into<SharedString>, text: impl Into<SharedString>) -> Self
pub fn new(id: impl Into<SharedString>, text: impl Into<SharedString>) -> Self
A context line. The text begins on both sides; old and new numbers are supplied independently.
Sourcepub fn added(id: impl Into<SharedString>, text: impl Into<SharedString>) -> Self
pub fn added(id: impl Into<SharedString>, text: impl Into<SharedString>) -> Self
A pure addition supplied by the caller.
Sourcepub fn removed(
id: impl Into<SharedString>,
text: impl Into<SharedString>,
) -> Self
pub fn removed( id: impl Into<SharedString>, text: impl Into<SharedString>, ) -> Self
A pure removal supplied by the caller.
Sourcepub fn paired(
id: impl Into<SharedString>,
old: impl Into<SharedString>,
new: impl Into<SharedString>,
) -> Self
pub fn paired( id: impl Into<SharedString>, old: impl Into<SharedString>, new: impl Into<SharedString>, ) -> Self
An aligned replacement supplied by the caller. Unified presentation draws its removed and added sides as consecutive rows; split presentation draws them opposite one another.
pub fn old_number(self, number: usize) -> Self
pub fn new_number(self, number: usize) -> Self
Sourcepub fn spans(self, spans: impl IntoIterator<Item = CodeSpan>) -> Self
pub fn spans(self, spans: impl IntoIterator<Item = CodeSpan>) -> Self
Pre-classified spans for both sides. Use old_spans and new_spans
when an aligned replacement has different classifications.
pub fn old_spans(self, spans: impl IntoIterator<Item = CodeSpan>) -> Self
pub fn new_spans(self, spans: impl IntoIterator<Item = CodeSpan>) -> Self
Trait Implementations§
impl Eq for DiffLine
impl StructuralPartialEq for DiffLine
Auto Trait Implementations§
impl Freeze for DiffLine
impl RefUnwindSafe for DiffLine
impl Send for DiffLine
impl Sync for DiffLine
impl Unpin for DiffLine
impl UnsafeUnpin for DiffLine
impl UnwindSafe for DiffLine
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more