pub struct DiffDocument {
pub repo_root: String,
pub files: Vec<FileDiff>,
}Expand description
A complete renderer-neutral review snapshot: every changed file with its patch and, when captured, both complete source versions.
Fields§
§repo_root: String§files: Vec<FileDiff>Implementations§
Source§impl DiffDocument
impl DiffDocument
pub fn empty() -> Self
Sourcepub fn from_texts<'a, T, U>(files: U) -> Result<Self, DiffError>where
T: TryInto<RepoPath>,
T::Error: Into<RepoPathError>,
U: IntoIterator<Item = (T, &'a str, &'a str)>,
pub fn from_texts<'a, T, U>(files: U) -> Result<Self, DiffError>where
T: TryInto<RepoPath>,
T::Error: Into<RepoPathError>,
U: IntoIterator<Item = (T, &'a str, &'a str)>,
Builds a complete document from full old/new text pairs, deriving
pub fn file_index(&self, path: &RepoPath) -> Option<usize>
Source§impl DiffDocument
impl DiffDocument
Sourcepub fn from_git_outputs(
repo_root: impl Into<String>,
diff: &[u8],
porcelain: &[u8],
scope: DiffScope,
) -> Result<Self, DiffError>
pub fn from_git_outputs( repo_root: impl Into<String>, diff: &[u8], porcelain: &[u8], scope: DiffScope, ) -> Result<Self, DiffError>
Builds a document from Git patch and porcelain status output.
§Errors
Returns an error when either Git output cannot be parsed or normalized.
Sourcepub fn from_git_outputs_with_untracked(
repo_root: impl Into<String>,
diff: &[u8],
porcelain: &[u8],
scope: DiffScope,
untracked: &[UntrackedFile],
) -> Result<Self, DiffError>
pub fn from_git_outputs_with_untracked( repo_root: impl Into<String>, diff: &[u8], porcelain: &[u8], scope: DiffScope, untracked: &[UntrackedFile], ) -> Result<Self, DiffError>
Builds a document from Git outputs plus separately loaded untracked files.
§Errors
Returns an error when Git output or untracked file data cannot be parsed or normalized.
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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::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
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