[−][src]Struct bdrck::cli::MaybePromptedString
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]
provided: Option<&str>,
output_stream: Stream,
prompt: &str,
is_sensitive: bool,
confirm: bool
) -> Result<Self>
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
impl Send for MaybePromptedString
impl Unpin for MaybePromptedString
impl Sync for MaybePromptedString
impl UnwindSafe for MaybePromptedString
impl RefUnwindSafe for MaybePromptedString
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
fn vzip(self) -> V
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,