[][src]Enum doublysure::AreYouSure

pub enum AreYouSure<T> {
    Value(T),
    DeferredFunction(Box<dyn Fn() -> T>),
}

A type that asks the user the all important question: Are you sure you want to do this?

The functions on this type are intentionally verbose so that users understand that they are confirming a potentially destructive action.

Variants

Value(T)

A value that will be returned when yes_i_am_sure() is called.

DeferredFunction(Box<dyn Fn() -> T>)

A function that was deferred and will be run later when yes_i_am_sure() is called.

Implementations

impl<T> AreYouSure<T>[src]

pub fn new(val: T) -> Self[src]

Creates a new AreYouSure wrapping around a value. This is the same as AreYouSure::Value().

The make_sure macro is the preferred way of creating an AreYouSure.

pub fn yes_i_am_sure(self) -> T[src]

You are, in fact, sure that you want to do this.

Returns the inner value, or runs the deferred function and returns whatever it does.

pub fn no_i_am_not_sure(self)[src]

You're not actually sure you want to do this.

This will discard the AreYouSure dropping it's value and will not run deferred functions.

Auto Trait Implementations

impl<T> !RefUnwindSafe for AreYouSure<T>

impl<T> !Send for AreYouSure<T>

impl<T> !Sync for AreYouSure<T>

impl<T> Unpin for AreYouSure<T> where
    T: Unpin

impl<T> !UnwindSafe for AreYouSure<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.