pub struct DiffDocument {
pub hunks: Vec<DiffHunk>,
pub stats: DiffStats,
/* private fields */
}Expand description
A complete renderer-independent diff.
Fields§
§hunks: Vec<DiffHunk>Structured hunks.
stats: DiffStatsWhole-document statistics.
Implementations§
Source§impl DiffDocument
impl DiffDocument
Sourcepub fn between(old: &str, new: &str, options: DiffOptions<'_>) -> DiffDocument
pub fn between(old: &str, new: &str, options: DiffOptions<'_>) -> DiffDocument
Computes a bounded diff from before/after text.
Sourcepub fn from_hunks(hunks: Vec<DiffHunk>) -> DiffDocument
pub fn from_hunks(hunks: Vec<DiffHunk>) -> DiffDocument
Constructs a document from precomputed hunks.
Sourcepub fn from_unified(input: &str) -> Result<DiffDocument, ParseDiffError>
pub fn from_unified(input: &str) -> Result<DiffDocument, ParseDiffError>
Parses unified-diff text into a structured document.
File metadata is accepted and ignored. A body line before the first valid hunk header is rejected instead of receiving invented numbers.
Sourcepub fn layout(&self, options: LayoutOptions) -> Vec<DiffRow>
pub fn layout(&self, options: LayoutOptions) -> Vec<DiffRow>
Lays out this document with terminal display-width wrapping.
Trait Implementations§
Source§impl Clone for DiffDocument
impl Clone for DiffDocument
Source§fn clone(&self) -> DiffDocument
fn clone(&self) -> DiffDocument
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 DiffDocument
impl Debug for DiffDocument
Source§impl Default for DiffDocument
impl Default for DiffDocument
Source§fn default() -> DiffDocument
fn default() -> DiffDocument
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for DiffDocument
impl<'de> Deserialize<'de> for DiffDocument
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<DiffDocument, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DiffDocument, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for DiffDocument
Source§impl PartialEq for DiffDocument
impl PartialEq for DiffDocument
Source§impl Serialize for DiffDocument
impl Serialize for DiffDocument
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for DiffDocument
Auto Trait Implementations§
impl Freeze for DiffDocument
impl RefUnwindSafe for DiffDocument
impl Send for DiffDocument
impl Sync for DiffDocument
impl Unpin for DiffDocument
impl UnsafeUnpin for DiffDocument
impl UnwindSafe for DiffDocument
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.