MCPcopy Create free account
hub / github.com/dfinity/ic-repl / pretty_parse

Function pretty_parse

src/error.rs:45–56  ·  view source on GitHub ↗
(name: &str, str: &str)

Source from the content-addressed store, hash-verified

43}
44
45pub fn pretty_parse<T>(name: &str, str: &str) -> Result<T, ParserError>
46where
47 T: std::str::FromStr<Err = ParserError>,
48{
49 let str = shellexpand::env(str).map_err(|e| error2(e, 0..0))?;
50 str.parse::<T>().inspect_err(|e| {
51 let writer = StandardStream::stderr(term::termcolor::ColorChoice::Auto);
52 let config = term::Config::default();
53 let file = SimpleFile::new(name, str);
54 term::emit(&mut writer.lock(), &config, &file, &report(e)).unwrap();
55 })
56}

Callers

nothing calls this directly

Calls 2

error2Function · 0.85
reportFunction · 0.85

Tested by

no test coverage detected