MCPcopy Create free account
hub / github.com/alignoth/alignoth / from_str

Method from_str

src/cli.rs:205–219  ·  view source on GitHub ↗
(s: &str)

Source from the content-addressed store, hash-verified

203 type Err = anyhow::Error;
204
205 fn from_str(s: &str) -> Result<Self, Self::Err> {
206 let (target, range) = s.split_once(':').context("No ':' in region string")?;
207 let (start, end) = range.split_once('-').context("No '-' in region string")?;
208 let start = start.parse::<i64>().context(format!(
209 "Could not parse integer from given region start {start}"
210 ))? - 1; // Compensate 1-based region specification
211 let end = end.parse::<i64>().context(format!(
212 "Could not parse integer from given region end {end}"
213 ))?; // No compensation so the region is fully inclusive
214 Ok(Region {
215 target: target.into(),
216 start,
217 end,
218 })
219 }
220}
221
222pub(crate) trait FromAround {

Callers

nothing calls this directly

Calls 2

OkFunction · 0.85
contextMethod · 0.45

Tested by

no test coverage detected