pub struct PromptModule<Q> { /* private fields */ }Expand description
A collection of questions and answers for previously answered questions.
Unlike prompt, this allows you to control how many questions you want to ask, and ask with
previous answers as well.
Implementations§
Source§impl<'a, Q> PromptModule<Q>
impl<'a, Q> PromptModule<Q>
Sourcepub fn new<I>(questions: I) -> Selfwhere
I: IntoIterator<IntoIter = Q, Item = Question<'a>>,
pub fn new<I>(questions: I) -> Selfwhere
I: IntoIterator<IntoIter = Q, Item = Question<'a>>,
Creates a new PromptModule with the given questions
Sourcepub fn with_answers(self, answers: Answers) -> Self
pub fn with_answers(self, answers: Answers) -> Self
Creates a PromptModule with the given questions and answers
Sourcepub fn prompt(&mut self) -> Result<Option<&mut Answer>>
Available on crate features crossterm or termion only.
pub fn prompt(&mut self) -> Result<Option<&mut Answer>>
crossterm or termion only.Prompt a single question with the default Backend and EventIterator.
This may or may not actually prompt the question based on what when and ask_if_answered
returns for that particular question.
Sourcepub fn prompt_with<B, E>(
&mut self,
backend: &mut B,
events: &mut E,
) -> Result<Option<&mut Answer>>where
B: Backend,
E: EventIterator,
pub fn prompt_with<B, E>(
&mut self,
backend: &mut B,
events: &mut E,
) -> Result<Option<&mut Answer>>where
B: Backend,
E: EventIterator,
Prompt a single question with the given Backend and EventIterator.
This may or may not actually prompt the question based on what when and ask_if_answered
returns for that particular question.
Sourcepub fn prompt_all(self) -> Result<Answers>
Available on crate features crossterm or termion only.
pub fn prompt_all(self) -> Result<Answers>
crossterm or termion only.Prompt all remaining questions with the default Backend and EventIterator.
It consumes self and returns the answers to all the questions asked.
Sourcepub fn prompt_all_with<B, E>(
self,
backend: &mut B,
events: &mut E,
) -> Result<Answers>where
B: Backend,
E: EventIterator,
pub fn prompt_all_with<B, E>(
self,
backend: &mut B,
events: &mut E,
) -> Result<Answers>where
B: Backend,
E: EventIterator,
Prompt all remaining questions with the given Backend and EventIterator.
It consumes self and returns the answers to all the questions asked.
Sourcepub fn into_answers(self) -> Answers
pub fn into_answers(self) -> Answers
Consumes self returning the answers to the previously asked questions.
Trait Implementations§
Source§impl<Q: Clone> Clone for PromptModule<Q>
impl<Q: Clone> Clone for PromptModule<Q>
Source§fn clone(&self) -> PromptModule<Q>
fn clone(&self) -> PromptModule<Q>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more