Interesting to see this as a novel thing in another ecosystem. Rust actually uses "stream" manipulation as a default way of dealing with things that might otherwise be expressed as full data structures. For example, the equivalent to one of the code snippets in the article would be:
BufReader::new(File::open("myfile.txt").unwrap())
.lines()
.enumerate()
.map(|(i, line)| format!("{}: {}", i, line.unwrap()))
.take(1)
.next().unwrap()
(formatted for non-monospace font readability). Note the .unwrap() is where error handling should normally happen.
BufReader::new(File::open("myfile.txt").unwrap())
.lines()
.enumerate()
.map(|(i, line)| format!("{}: {}", i, line.unwrap()))
.take(1)
.next().unwrap()
(formatted for non-monospace font readability). Note the .unwrap() is where error handling should normally happen.