pub struct ConfirmPromptSource<T: TerminalIO = RealTerminal> { /* private fields */ }Expand description
Simple yes/no confirmation prompt.
Prompts the user for a yes/no response. Accepts y/yes/n/no (case-insensitive).
§Example
ⓘ
use standout_input::{InputChain, FlagSource, ConfirmPromptSource};
let chain = InputChain::<bool>::new()
.try_source(FlagSource::new("yes"))
.try_source(ConfirmPromptSource::new("Proceed?"));
let confirmed = chain.resolve(&matches)?;Implementations§
Source§impl ConfirmPromptSource<RealTerminal>
impl ConfirmPromptSource<RealTerminal>
Source§impl<T: TerminalIO> ConfirmPromptSource<T>
impl<T: TerminalIO> ConfirmPromptSource<T>
Sourcepub fn with_terminal(prompt: impl Into<String>, terminal: T) -> Self
pub fn with_terminal(prompt: impl Into<String>, terminal: T) -> Self
Create a confirm prompt with a custom terminal for testing.
Trait Implementations§
Source§impl<T: Clone + TerminalIO> Clone for ConfirmPromptSource<T>
impl<T: Clone + TerminalIO> Clone for ConfirmPromptSource<T>
Source§fn clone(&self) -> ConfirmPromptSource<T>
fn clone(&self) -> ConfirmPromptSource<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: TerminalIO + 'static> InputCollector<bool> for ConfirmPromptSource<T>
impl<T: TerminalIO + 'static> InputCollector<bool> for ConfirmPromptSource<T>
Source§fn is_available(&self, _matches: &ArgMatches) -> bool
fn is_available(&self, _matches: &ArgMatches) -> bool
Check if this collector can provide input in the current environment. Read more
Source§fn collect(&self, _matches: &ArgMatches) -> Result<Option<bool>, InputError>
fn collect(&self, _matches: &ArgMatches) -> Result<Option<bool>, InputError>
Attempt to collect input from this source. Read more
Auto Trait Implementations§
impl<T> Freeze for ConfirmPromptSource<T>
impl<T> RefUnwindSafe for ConfirmPromptSource<T>where
T: RefUnwindSafe,
impl<T> Send for ConfirmPromptSource<T>
impl<T> Sync for ConfirmPromptSource<T>
impl<T> Unpin for ConfirmPromptSource<T>
impl<T> UnwindSafe for ConfirmPromptSource<T>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more