Check out example codes for "how to read from stdin rust". It will help you in understanding the concepts better.

Code Example 1

use std::io;

let mut input = String::new();
match io::stdin().read_line(&mut input) {
    Ok(n) => {
        println!("{} bytes read", n);
        println!("{}", input);
    }
    Err(error) => println!("error: {}", error),
}Run

Learn ReactJs, React Native from akashmittal.com