MCPcopy Create free account
hub / github.com/bedroombuilds/python2rust / main

Function main

0d_files/rust/simple.rs:4–20  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2use std::io::{self, BufRead, BufReader};
3
4fn main() -> io::Result<()> {
5 let args: Vec<String> = std::env::args().collect();
6
7 let file = File::open(&args[1])?;
8 let reader = BufReader::new(file);
9
10 let mut found = 0usize;
11 for line in reader.lines() {
12 let line = line?;
13 let elems: Vec<&str> = line.split(',').collect();
14 if elems[1] == "Tanzania" {
15 found += 1;
16 }
17 }
18 println!("found {} sales for Tanzania", found);
19 Ok(())
20}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected