Enum Resettable

enum Resettable<T>

Clearable builder value

This allows a builder function to both accept any value that can Into::into T (like &str into OsStr) as well as None to reset it to the default. This is needed to workaround a limitation where you can't have a function argument that is impl Into<Option<T>> where T is impl Into<S> accept None as its type is ambiguous.

Example

# use clap_builder as clap;
# use clap::Command;
# use clap::Arg;
fn common() -> Command {
    Command::new("cli")
        .arg(Arg::new("input").short('i').long("input"))
}
let mut command = common();
command.mut_arg("input", |arg| arg.short(None));

Variants

Value(T)

Overwrite builder value

Reset

Reset builder value

Implementations

impl<T> Any for Resettable<T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Resettable<T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Resettable<T>

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

impl<T> CloneToUninit for Resettable<T>

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

impl<T> Freeze for Resettable<T>

impl<T> From for Resettable<T>

fn from(other: T) -> Self

impl<T> From for Resettable<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> From for Resettable<T>

fn from(other: Option<T>) -> Self

impl<T> From for Resettable<T>

fn from(t: never) -> T

impl<T> IntoResettable for Resettable<T>

fn into_resettable(self: Self) -> Resettable<T>

impl<T> RefUnwindSafe for Resettable<T>

impl<T> Send for Resettable<T>

impl<T> StructuralPartialEq for Resettable<T>

impl<T> Sync for Resettable<T>

impl<T> ToOwned for Resettable<T>

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T> Unpin for Resettable<T>

impl<T> UnsafeUnpin for Resettable<T>

impl<T> UnwindSafe for Resettable<T>

impl<T, U> Into for Resettable<T>

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for Resettable<T>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Resettable<T>

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

impl<T: $crate::clone::Clone> Clone for Resettable<T>

fn clone(self: &Self) -> Resettable<T>

impl<T: $crate::cmp::Eq> Eq for Resettable<T>

impl<T: $crate::cmp::Ord> Ord for Resettable<T>

fn cmp(self: &Self, other: &Resettable<T>) -> Ordering

impl<T: $crate::cmp::PartialEq> PartialEq for Resettable<T>

fn eq(self: &Self, other: &Resettable<T>) -> bool

impl<T: $crate::cmp::PartialOrd> PartialOrd for Resettable<T>

fn partial_cmp(self: &Self, other: &Resettable<T>) -> Option<Ordering>

impl<T: $crate::fmt::Debug> Debug for Resettable<T>

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

impl<T: $crate::hash::Hash> Hash for Resettable<T>

fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)

impl<T: $crate::marker::Copy> Copy for Resettable<T>