https://github.com/DanielKeep/cargo-script

$ cargo install cargo-script

Cmd

$ cargo script file.rs

OR add alias:

$ alias runrs='cargo script'

$ runrs file.rs

Script

$ cat file.rs
#!/usr/bin/env run-cargo-script
fn main() {
    println!("Hello World!");
}

$ chmod +x file.rs
$ ./file.rs

$ cat file.rs 
#!/usr/bin/env run-cargo-script
//! ```cargo
//! [dependencies]
//! time = "0.1.25"
//! ```
extern crate time;
fn main() {
    println!("{}", time::now().rfc822z());
}

OR

$ cat file.rs 
#!/usr/bin/env run-cargo-script
// cargo-deps: time="0.1.25"
extern crate time;
fn main() {
    println!("{}", time::now().rfc822z());
}

scriptisto

https://github.com/igor-petruk/scriptisto

A language-agnostic “shebang interpreter” that enables you to write scripts in compiled languages.

rust-script

https://rust-script.org/ [GitHub]

Run Rust files and expressions as scripts without any setup or compilation step.