pub struct Confirm<'a> { /* private fields */ }Expand description
Builder for a yes/no confirmation prompt.
Wraps Terminal::confirm with a chainable configuration API. Call
Confirm::ask to display the prompt and block until the user answers.
§Example
use vecli::Confirm;
let confirmed = Confirm::new("Delete file?")
.default(false)
.ask();Implementations§
Source§impl<'a> Confirm<'a>
impl<'a> Confirm<'a>
Sourcepub fn new(prompt: &'a str) -> Self
pub fn new(prompt: &'a str) -> Self
Creates a new Confirm with the given question text.
Defaults to false when the user presses Enter, with the default indicator visible.
Sourcepub fn default(self, default: bool) -> Self
pub fn default(self, default: bool) -> Self
Sets the value returned when the user presses Enter with no input.
Sourcepub fn show_default(self, show: bool) -> Self
pub fn show_default(self, show: bool) -> Self
Controls whether [Y/n] or [y/N] is appended to the prompt text.
Auto Trait Implementations§
impl<'a> Freeze for Confirm<'a>
impl<'a> RefUnwindSafe for Confirm<'a>
impl<'a> Send for Confirm<'a>
impl<'a> Sync for Confirm<'a>
impl<'a> Unpin for Confirm<'a>
impl<'a> UnsafeUnpin for Confirm<'a>
impl<'a> UnwindSafe for Confirm<'a>
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