Project: Total Filter (Integer)
Write a filter program that accepts text representations of integer values, one per line, and then computes and prints the total. The program should print an error to STDERR if a line of input can't be parsed as an integer value.
Output
$ rustc TotalFilterInt.rs
error: unknown format trait `d`
--> TotalFilterInt.rs:34:29
|
34 | println!("{}", format!("{0:d}", total));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error[E0425]: cannot find value `Utils` in this scope
--> TotalFilterInt.rs:17:12
|
17 | line = &(Utils.trim(line));
| ^^^^^ not found in this scope
error[E0425]: cannot find function `getline` in this scope
--> TotalFilterInt.rs:16:8
|
16 | while getline(line) {
| ^^^^^^^ not found in this scope
error[E0425]: cannot find function `stoi` in this scope
--> TotalFilterInt.rs:19:8
|
19 | d = stoi(line)?;
| ^^^^ not found in this scope
error[E0425]: cannot find function `strlen` in this scope
--> TotalFilterInt.rs:26:9
|
26 | if strlen(line) > 0 {
| ^^^^^^ not found in this scope
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0425`.
$ rustc TotalFilterInt.rs
error: unknown format trait `d`
--> TotalFilterInt.rs:34:29
|
34 | println!("{}", format!("{0:d}", total));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error[E0425]: cannot find value `Utils` in this scope
--> TotalFilterInt.rs:17:12
|
17 | line = &(Utils.trim(line));
| ^^^^^ not found in this scope
error[E0425]: cannot find function `getline` in this scope
--> TotalFilterInt.rs:16:8
|
16 | while getline(line) {
| ^^^^^^^ not found in this scope
error[E0425]: cannot find function `stoi` in this scope
--> TotalFilterInt.rs:19:8
|
19 | d = stoi(line)?;
| ^^^^ not found in this scope
error[E0425]: cannot find function `strlen` in this scope
--> TotalFilterInt.rs:26:9
|
26 | if strlen(line) > 0 {
| ^^^^^^ not found in this scope
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0425`.
$ rustc TotalFilterInt.rs
error: unknown format trait `d`
--> TotalFilterInt.rs:34:29
|
34 | println!("{}", format!("{0:d}", total));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error[E0425]: cannot find value `Utils` in this scope
--> TotalFilterInt.rs:17:12
|
17 | line = &(Utils.trim(line));
| ^^^^^ not found in this scope
error[E0425]: cannot find function `getline` in this scope
--> TotalFilterInt.rs:16:8
|
16 | while getline(line) {
| ^^^^^^^ not found in this scope
error[E0425]: cannot find function `stoi` in this scope
--> TotalFilterInt.rs:19:8
|
19 | d = stoi(line)?;
| ^^^^ not found in this scope
error[E0425]: cannot find function `strlen` in this scope
--> TotalFilterInt.rs:26:9
|
26 | if strlen(line) > 0 {
| ^^^^^^ not found in this scope
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0425`.