I started learning Rust lately. Kind of interesting but more to learn. Here is the program that help to get the input from user in console. I am sure this might help you.
fn main() {
print!("Please enter some text: ");
let input=get_input();
println!("Input = {0}", input);
}
The following code defines how you write functions.
fn get_input() -> String { return someString;}
Below is the function to get input from the stream and return as string.
fn get_input() -> String {
use std::io::{stdin,stdout,Write};
let mut s=String::new();
let _=stdout().flush();
stdin().read_line(&mut s).expect("Did not enter a correct string");
if let Some('\n')=s.chars().next_back() {
s.pop();
}
if let Some('\r')=s.chars().next_back() {
s.pop();
}
return s;
}