Skip to main content

read_input_with_io

Function read_input_with_io 

Source
pub fn read_input_with_io<R: InputReader, W: OutputWriter>(
    prompt: &str,
    default_value: Option<&str>,
    trim_whitespace: bool,
    show_prompt: bool,
    reader: &mut R,
    writer: &mut W,
) -> Result<String, InputError>
Expand description

Internal helper function to read input with various options This version accepts generic reader/writer for testing

ยงArguments

  • prompt - The prompt text to display
  • default_value - Optional default value to return if input is empty
  • trim_whitespace - Whether to trim leading/trailing whitespace
  • show_prompt - Whether to display the prompt
  • reader - Input reader implementation
  • writer - Output writer implementation