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

Function report_expected

src/error.rs:27–43  ·  view source on GitHub ↗
(expected: &[String])

Source from the content-addressed store, hash-verified

25}
26
27fn report_expected(expected: &[String]) -> Vec<String> {
28 if expected.is_empty() {
29 return Vec::new();
30 }
31 use pretty::RcDoc;
32 let doc: RcDoc<()> = RcDoc::intersperse(
33 expected.iter().map(RcDoc::text),
34 RcDoc::text(",").append(RcDoc::softline()),
35 );
36 let header = if expected.len() == 1 {
37 "Expects"
38 } else {
39 "Expects one of"
40 };
41 let doc = RcDoc::text(header).append(RcDoc::softline().append(doc));
42 vec![doc.pretty(70).to_string()]
43}
44
45pub fn pretty_parse<T>(name: &str, str: &str) -> Result<T, ParserError>
46where

Callers 1

reportFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected