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() -> DiffDocument
Sourcepub fn from_texts<'a, T, U>(files: U) -> Result<DiffDocument, DiffError>where
T: TryInto<RepoPath>,
<T as TryInto<RepoPath>>::Error: Into<RepoPathError>,
U: IntoIterator<Item = (T, &'a str, &'a str)>,
pub fn from_texts<'a, T, U>(files: U) -> Result<DiffDocument, DiffError>where
T: TryInto<RepoPath>,
<T as TryInto<RepoPath>>::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<DiffDocument, DiffError>
pub fn from_git_outputs( repo_root: impl Into<String>, diff: &[u8], porcelain: &[u8], scope: DiffScope, ) -> Result<DiffDocument, 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<DiffDocument, DiffError>
pub fn from_git_outputs_with_untracked( repo_root: impl Into<String>, diff: &[u8], porcelain: &[u8], scope: DiffScope, untracked: &[UntrackedFile], ) -> Result<DiffDocument, 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<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.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> ⓘ
Converts
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> ⓘ
Converts
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