Skip to main content

Confirm

Struct Confirm 

Source
pub struct Confirm {
    pub mutations: Vec<Mutation>,
    pub typed_word: Option<String>,
    pub entered: String,
}
Expand description

What a confirmation is waiting for.

Fields§

§mutations: Vec<Mutation>

Every mutation this confirmation covers, in the order they will run. One for an ordinary action, one per selected row for a batch.

§typed_word: Option<String>

When set, the reader must type this exactly before the action is allowed. Reserved for the operations where a single keypress is too cheap for what it does.

§entered: String

What they have typed so far.

Implementations§

Source§

impl Confirm

Source

pub fn new(mutation: Mutation) -> Self

Source

pub fn batch(mutations: Vec<Mutation>) -> Self

A confirmation over several rows.

The word owed scales with what is at stake: destroying histories always costs the word, and a destructive batch costs the count, because one keypress is too cheap to end a dozen workflows at once.

Source

pub fn first(&self) -> &Mutation

The mutation that stands for the set: the first, which every other one matches in verb and namespace because a batch is one action over many rows.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn is_batch(&self) -> bool

Whether this covers more than one row, which is what the heading has to say.

Source

pub fn is_satisfied(&self) -> bool

Whether pressing Enter now would go ahead.

Source

pub fn caution(&self) -> Option<String>

Why a word is owed at all.

The renderer must not infer this from the word: “delete” is owed because a history is about to stop existing, a count is owed because one keypress is too cheap for the number of rows, and telling a reader that terminating destroys a history would be a lie in the one place that has to be exact.

Source

pub fn prompt(&self) -> String

What to tell the reader they still owe.

Trait Implementations§

Source§

impl Clone for Confirm

Source§

fn clone(&self) -> Confirm

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Confirm

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Confirm

Source§

impl PartialEq for Confirm

Source§

fn eq(&self, other: &Confirm) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Confirm

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.