pub trait Prompt: Debug {
fn ask(
self,
message: String,
answers: &Answers,
backend: &mut dyn Backend,
events: &mut dyn EventIterator
) -> Result<Option<Answer>>;
}
Expand description
Prompts are a way to write custom Question
s.
The prompt is given a message
, the previous Answers
and a Backend
and
EventIterator
. Using these, it is responsible for doing everything from rendering to user
interaction. While no particular look is enforced, it is recommended to keep a similar look to
the rest of the in-built questions.
You can use the requestty-ui
crate to build the prompts. You can see the implementations of
the in-built questions for examples on how to use it.
See also Question::custom