pub fn new<IS: AbstractStream, OS: AbstractStream>(
        provided: Option<&str>,
        mut input_stream: IS,
        mut output_stream: OS,
        prompt: &str,
        is_sensitive: bool,
        confirm: bool,
    ) -> Result<Self> {
        let mut input_reader = build_input_reader(&mut input_stream)?;
        let prompted: Option<String> = match provided {
            None => Some(match confirm {
                false => prompt_for_string_impl(
                    &mut input_stream,
                    &mut input_reader,
                    &mut output_stream,
                    prompt,
                    is_sensitive,
                )?,
                true => prompt_for_string_confirm_impl(
                    &mut input_stream,
                    &mut input_reader,
                    &mut output_stream,
                    prompt,
                    is_sensitive,
                )?,
            }),
            Some(_) => None,
        };

        let was_provided = provided.is_some();
        let value = provided.map_or_else(|| prompted.unwrap(), |s| s.to_owned());

        Ok(MaybePromptedString {
            value: value,
            was_provided: was_provided,
        })
    }
/// Construct a new MaybePromptedString, either using the given value or
/// prompting the user interactively with the given options.
Construct a new MaybePromptedString, either using the given value or
prompting the user interactively with the given options.
Construct a new MaybePromptedString either using the given value or prompting the user interactively with the given options .
pub fn new<IS: AbstractStream, OS: AbstractStream>(
        provided: Option<&str>,
        mut input_stream: IS,
        mut output_stream: OS,
        prompt: &str,
        is_sensitive: bool,
        confirm: bool,
    ) -> Result<Self> {
        let mut input_reader = build_input_reader(&mut input_stream)?;
        let prompted: Option<String> = match provided {
            None => Some(match confirm {
                false => prompt_for_string_impl(
                    &mut input_stream,
                    &mut input_reader,
                    &mut output_stream,
                    prompt,
                    is_sensitive,
                )?,
                true => prompt_for_string_confirm_impl(
                    &mut input_stream,
                    &mut input_reader,
                    &mut output_stream,
                    prompt,
                    is_sensitive,
                )?,
            }),
            Some(_) => None,
        };
        let was_provided = provided.is_some();
        let value = provided.map_or_else(|| prompted.unwrap(), |s| s.to_owned());
        Ok(MaybePromptedString {
            value: value,
            was_provided: was_provided,
        })
    }
pub fn new < IS : AbstractStream , OS : AbstractStream > ( provided : Option < & str > , mut input_stream : IS , mut output_stream : OS , prompt : & str , is_sensitive : bool , confirm : bool , ) -> Result < Self > { let mut input_reader = build_input_reader ( & mut input_stream ) ? ; let prompted : Option < String > = match provided { None => Some ( match confirm { false => prompt_for_string_impl ( & mut input_stream , & mut input_reader , & mut output_stream , prompt , is_sensitive , ) ? , true => prompt_for_string_confirm_impl ( & mut input_stream , & mut input_reader , & mut output_stream , prompt , is_sensitive , ) ? , } ) , Some ( _ ) => None , } ; let was_provided = provided . is_some ( ) ; let value = provided . map_or_else ( | | prompted . unwrap ( ) , | s | s . to_owned ( ) ) ; Ok ( MaybePromptedString { value : value , was_provided : was_provided , } ) }
Construct a new MaybePromptedString, either using the given value or
prompting the user interactively with the given options.
Construct a new MaybePromptedString either using the given value or prompting the user interactively with the given options .
provided
Option<&str>
input_stream
IS
output_stream
OS
prompt
&str
is_sensitive
bool
confirm
bool
provided
Option<&str>
input_stream
IS
output_stream
OS
prompt
&str
is_sensitive
bool
confirm
bool