MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / from_contents

Method from_contents

crates/opencode-tool/src/edit/replacers.rs:744–756  ·  view source on GitHub ↗
(old_content: &str, new_content: &str)

Source from the content-addressed store, hash-verified

742
743impl 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

Calls 1

newFunction · 0.85

Tested by

no test coverage detected