Method
from_contents
(old_content: &str, new_content: &str)
Source from the content-addressed store, hash-verified
| 742 | |
| 743 | impl FileDiff { |
| 744 | pub fn from_contents(old_content: &str, new_content: &str) -> Self { |
| 745 | let old_lines: Vec<&str> = old_content.lines().collect(); |
| 746 | let new_lines: Vec<&str> = new_content.lines().collect(); |
| 747 | |
| 748 | let additions = new_lines.len().saturating_sub(old_lines.len()); |
| 749 | let deletions = old_lines.len().saturating_sub(new_lines.len()); |
| 750 | |
| 751 | Self { |
| 752 | path: String::new(), |
| 753 | additions, |
| 754 | deletions, |
| 755 | } |
| 756 | } |
| 757 | } |
| 758 | |
| 759 | #[cfg(test)] |
Callers
nothing calls this directly
Tested by
no test coverage detected