pub struct LineStat {
pub insertions: usize,
pub deletions: usize,
}Expand description
Line insertion/deletion counts for one file (--numstat).
Fields§
§insertions: usizeLines added on the new side.
deletions: usizeLines removed from the old side.
Implementations§
Source§impl LineStat
impl LineStat
Sourcepub fn from_hunks(hunks: &[StructuredHunk]) -> Self
pub fn from_hunks(hunks: &[StructuredHunk]) -> Self
Count added and removed lines across structured hunks.
§Parameters
hunks: hunks of one file’s line diff.
§Returns
Insertions (StructuredLineKind::Add) and deletions
(StructuredLineKind::Del); context lines are not counted.
Sourcepub fn bar(self, max_changes: usize, width: usize) -> StatBar
pub fn bar(self, max_changes: usize, width: usize) -> StatBar
Scale this file’s change bar against the largest change in its diffstat.
Bars are drawn one column per changed line until max_changes exceeds
width; then every bar is scaled by width / max_changes, rounding up
so a changed file always gets at least one column. Within a bar the
columns are split between insertions and deletions in proportion,
keeping at least one column for each side that has changes.
§Parameters
max_changes: the largestLineStat::changesamong the rows drawn together (seeDiffStat::max_changes).width: column budget for the widest bar.
§Returns
Column counts for the + and - parts; both are zero when this file
has no changed lines.
Trait Implementations§
Source§impl AddAssign for LineStat
impl AddAssign for LineStat
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moreimpl Copy for LineStat
impl Eq for LineStat
Source§impl FromIterator<StructuredLineKind> for LineStat
impl FromIterator<StructuredLineKind> for LineStat
Source§fn from_iter<I: IntoIterator<Item = StructuredLineKind>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = StructuredLineKind>>(iter: I) -> Self
Count StructuredLineKind::Add as insertions and
StructuredLineKind::Del as deletions.
impl StructuralPartialEq for LineStat
Auto Trait Implementations§
impl Freeze for LineStat
impl RefUnwindSafe for LineStat
impl Send for LineStat
impl Sync for LineStat
impl Unpin for LineStat
impl UnsafeUnpin for LineStat
impl UnwindSafe for LineStat
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
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§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.