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
11
12
13
#!/bin/sh
set -e -u

# https://unix.stackexchange.com/questions/30091/fix-or-alternative-for-mktemp-in-os-x
mytmpdir=$(mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir')

cd "$mytmpdir"

printf '[toolchain]\nchannel = "non-existing"' > rust-toolchain.toml

printf 'println!("hello, world");' > script.rs

rust-script script.rs