pub fn complete_parser<Ctx, P: Parser<Ctx>>(
input: &str,
ctx: Ctx,
) -> BTreeSet<Cow<'static, str>>Expand description
Computes the completion suggestions for a value using an explicit parser
compute_parser takes an input as a string slice with a parsing context and returns a set of
completion suggestions for the last token in the input, if any.
This function is similar to complete but is expects a parser as its second generic parameter.
It is intended to be used with custom parsers or for types that don’t implement Parsable.
§Examples
use cmdparse::complete_parser;
use cmdparse::parsers::BooleanParser;
use std::collections::BTreeSet;
let suggestions = complete_parser::<_, BooleanParser>("tr", ());
assert_eq!(suggestions, BTreeSet::from(["ue".into()]));