pub struct DiffSegment {
pub value: String,
pub tag: DiffTag,
}
Available on crate feature
diff
only.Expand description
A contiguous span in a diff.
A Diff
consists of a list of segments. Each segment represents either:
- Something that is in the actual value but not the expected value (an insertion).
- Something that is in the expected value but not the actual value (a deletion).
- Something that is the same between the two values.
The “something” that was inserted, deleted, or unchanged in the diff is value
.
See Diffable
for more information.
Fields§
§value: String
The string representation of the thing that was inserted, deleted, or unchanged.
tag: DiffTag
Whether this segment represents an insertion, a deletion, or no change.
Implementations§
Source§impl DiffSegment
impl DiffSegment
Sourcepub fn from_debug(value: impl Debug, tag: DiffTag) -> Self
pub fn from_debug(value: impl Debug, tag: DiffTag) -> Self
Create a DiffSegment
from a value that implements Debug
.
Sourcepub fn from_display(value: impl Display, tag: DiffTag) -> Self
pub fn from_display(value: impl Display, tag: DiffTag) -> Self
Create a DiffSegment
from a value that implements Display
.
Trait Implementations§
Source§impl Clone for DiffSegment
impl Clone for DiffSegment
Source§fn clone(&self) -> DiffSegment
fn clone(&self) -> DiffSegment
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for DiffSegment
impl Debug for DiffSegment
Source§impl Hash for DiffSegment
impl Hash for DiffSegment
Source§impl PartialEq for DiffSegment
impl PartialEq for DiffSegment
impl Eq for DiffSegment
impl StructuralPartialEq for DiffSegment
Auto Trait Implementations§
impl Freeze for DiffSegment
impl RefUnwindSafe for DiffSegment
impl Send for DiffSegment
impl Sync for DiffSegment
impl Unpin for DiffSegment
impl UnwindSafe for DiffSegment
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