ratatui_toolkit/widgets/code_diff/widget/methods/removed_count.rs
1use crate::widgets::code_diff::code_diff::CodeDiff;
2
3impl CodeDiff {
4 /// Returns the total number of removed lines across all hunks.
5 ///
6 /// # Returns
7 ///
8 /// The count of all removed lines
9 ///
10 /// # Example
11 ///
12 /// ```rust
13 /// use ratatui_toolkit::code_diff::CodeDiff;
14 ///
15 /// let diff = CodeDiff::from_unified_diff("@@ -1,2 +1 @@\n-removed");
16 /// assert_eq!(diff.removed_count(), 1);
17 /// ```
18 pub fn removed_count(&self) -> usize {
19 self.hunks.iter().map(|h| h.removed_count()).sum()
20 }
21}