clair 0.1.0

Command-Line Arithmetic in Rust
Documentation
  • Coverage
  • 0%
    0 out of 26 items documented0 out of 20 items with examples
  • Size
  • Source code size: 18.98 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.75 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • hanslovsky/clair
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • hanslovsky

CLAIR—Command Line Arithmetic in Rust

CLAIR is a small personal project for exploring the Rust programming language. It implements arithmetic operations on lines of string (currently only stdin, but support for files as input is planned). This is inspired by using awk for command line arithmetics.

Build

cargo build [--release]

Run

cargo run [--release] --bin={count,mean,product,sum} [</path/to/file/as/stdin] [--help]

or directly form target:

./target/release/{count,mean,product,sum}

Example

Count

$ ./target/release/count < Cargo.toml
24

# Reference:
$ wc -l Cargo.toml
24 Cargo.toml

Mean

$ shuf -i 1-100 | ./target/release/mean
50.5

# Reference:
$ shuf -i 1-100 | awk '{x += $1} END {print(x/100)}'
50.5

Product

$ shuf -i 1-6 | ./target/release/product
720

# Reference:
$ shuf -i 1-6 | awk 'BEGIN {x=1} {x *= $1} END {print(x)}'
720

Sum

$ shuf -i 1-100 | ./target/release/sum
5050

# Reference:
$ shuf -i 1-100 | awk '{x += $1} END {print(x)}'
5050