RunRS is based on rust-script, can run single file Rust source code.
Source code: https://git.hatter.ink/hatter/runrs
Preinstallation, install Rust from rustup.rs or rsproxy.cn
Install runrs:
cargo install --git https://git.hatter.ink/hatter/runrs runrs
Write a Rust script, sample:
$ echo '#!/usr/bin/env runrs fn main() { println!("Hello World!"); } ' > test.rs $ chmod +x test.rs $ ./test.rs [INFO ] Cached binary not exists, RUNRS_SILENT_BUILD=1 turn off Compiling test v0.1.0 (~/Library/Caches/rust-script/projects/1eafa4a131d021b425379cda) Finished release [optimized] target(s) in 1.48s Running `~/Library/Caches/rust-script/binaries/release/a69cc7921b8aeec0d1c207f1b64f64118f543dee923167a264e6bfb79377a33d` Hello World!