rust-script 0.36.0

Command-line tool to run Rust "scripts" which can make use of crates.
1
2
3
4
5
6
7
8
9
10
#!/bin/sh
set -e -u

echo "First:"
echo "line1\nline2" | rust-script --loop \
    "let mut n=0; move |l| {n+=1; println!(\"{:>6}: {}\",n,l.trim_end())}"

echo "Second:"
echo "line1\nline2" | rust-script --count --loop \
    "|l,n| println!(\"{:>6}: {}\", n, l.trim_end())"