MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / from_str

Method from_str

atomic-repository/src/diff_engine.rs:82–93  ·  view source on GitHub ↗

Parse a diff format from string. # Accepted Values - "unified" → `DiffFormat::Unified` - "stat" → `DiffFormat::Stat` - "name-only", "nameonly" → `DiffFormat::NameOnly` - "name-status", "namestatus" → `DiffFormat::NameStatus` # Errors Returns an error string if the format is not recognized.

(s: &str)

Source from the content-addressed store, hash-verified

80 ///
81 /// Returns an error string if the format is not recognized.
82 fn from_str(s: &str) -> Result<Self, Self::Err> {
83 match s.to_lowercase().as_str() {
84 "unified" | "u" => Ok(DiffFormat::Unified),
85 "stat" | "s" => Ok(DiffFormat::Stat),
86 "name-only" | "nameonly" | "names" => Ok(DiffFormat::NameOnly),
87 "name-status" | "namestatus" | "status" => Ok(DiffFormat::NameStatus),
88 _ => Err(format!(
89 "unknown diff format '{}'. Valid options: unified, stat, name-only, name-status",
90 s
91 )),
92 }
93 }
94}
95
96// Diff Statistics

Callers

nothing calls this directly

Calls 1

as_strMethod · 0.45

Tested by

no test coverage detected