Struct bdrck::cli::MaybePromptedString
source · [−]pub struct MaybePromptedString { /* private fields */ }
Expand description
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.
Implementations
pub fn new<IS: AbstractStream, OS: AbstractStream>(
provided: Option<&str>,
input_stream: IS,
output_stream: OS,
prompt: &str,
is_sensitive: bool,
confirm: bool
) -> Result<Self>
pub fn new<IS: AbstractStream, OS: AbstractStream>(
provided: Option<&str>,
input_stream: IS,
output_stream: OS,
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.
Returns true if this string was provided, or false if it is the result of an interactive prompt.
“Unwraps” this structure into its underlying string.
Auto Trait Implementations
impl RefUnwindSafe for MaybePromptedString
impl Send for MaybePromptedString
impl Sync for MaybePromptedString
impl Unpin for MaybePromptedString
impl UnwindSafe for MaybePromptedString
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more