実装

use std::io;
use std::io::BufRead;

fn main() {
    let stdin = io::stdin();
    for line_result in stdin.lock().lines() {
	println!("DATA: {:?}", line_result);
    }
}
main.rs

ビルド

$ rustc main.rs

実行

bash-5.1$ echo aaaaaaaaaaaaaa | ./main
DATA: Ok("aaaaaaaaaaaaaa")