[][src]Struct bdrck::cli::MaybePromptedString

pub struct MaybePromptedString { /* fields omitted */ }

MaybePromptedString is a wrapper for getting user input interactively, while also allowing the value to be specified at call time. This is useful e.g. when we want to prompt users interactively, but want to predefine the values in unit tests, or when users can specify a value either interactively or via flags.

Methods

impl MaybePromptedString[src]

pub fn new(
    provided: Option<&str>,
    output_stream: Stream,
    prompt: &str,
    is_sensitive: bool,
    confirm: bool
) -> Result<Self>
[src]

Construct a new MaybePromptedString, either using the given value or prompting the user interactively with the given options.

pub fn was_provided(&self) -> bool[src]

Returns true if this string was provided, or false if it is the result of an interactive prompt.

pub fn into_inner(self) -> String[src]

"Unwraps" this structure into its underlying string.

Auto Trait Implementations

Blanket Implementations

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

impl<T> From<T> for 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.

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

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

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

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

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

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