pub enum Confirmation {
TypeToken {
message: &'static str,
token: &'static str,
},
YesNo {
message: &'static str,
},
}Expand description
Pre-invocation confirmation gate.
Declared in the command manifest and checked by the CLI dispatch layer before the handler runs. Has no effect on HTTP endpoints - the API is not interactive.
Variants§
TypeToken
Prompt the user to type an exact token (e.g. "RESET").
The message is printed to stderr first, then the user is asked
to type token. Any other input aborts.
YesNo
Simple yes/no prompt. The message is shown, and the user must
type y or yes (case-insensitive) to proceed.
Implementations§
Source§impl Confirmation
impl Confirmation
Sourcepub fn prompt<R: BufRead, W: Write>(
&self,
reader: &mut R,
writer: &mut W,
) -> Result<bool>
pub fn prompt<R: BufRead, W: Write>( &self, reader: &mut R, writer: &mut W, ) -> Result<bool>
Run the confirmation prompt on the given reader/writer pair.
Returns Ok(true) if the user confirmed, Ok(false) if they
declined, and Err on I/O failure.
Sourcepub fn prompt_stdio(&self) -> Result<bool>
pub fn prompt_stdio(&self) -> Result<bool>
Convenience: prompt on real stdin/stderr.
Trait Implementations§
Source§impl Clone for Confirmation
impl Clone for Confirmation
Source§fn clone(&self) -> Confirmation
fn clone(&self) -> Confirmation
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for Confirmation
Source§impl Debug for Confirmation
impl Debug for Confirmation
impl Eq for Confirmation
Source§impl PartialEq for Confirmation
impl PartialEq for Confirmation
Source§fn eq(&self, other: &Confirmation) -> bool
fn eq(&self, other: &Confirmation) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for Confirmation
Auto Trait Implementations§
impl Freeze for Confirmation
impl RefUnwindSafe for Confirmation
impl Send for Confirmation
impl Sync for Confirmation
impl Unpin for Confirmation
impl UnsafeUnpin for Confirmation
impl UnwindSafe for Confirmation
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