Created
January 26, 2018 10:23
-
-
Save KeenS/d0dd7beaf35f2c8889729957fc21a835 to your computer and use it in GitHub Desktop.
Rustでちろっとコード試すのに便利なシェル関数
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/zsh | |
| # cargo install cargo-scriptしておく。これだけでも便利 | |
| # 下記関数でタイプ数節約できる & ツールチェーン切り替えられる | |
| rust() { | |
| local toolchain=+stable | |
| if [[ "$1" =~ "\+.+" ]]; then | |
| toolchain="$1" | |
| shift | |
| fi | |
| cargo "$toolchain" script "$@" | |
| } | |
| # $ rust hoge.rs | |
| # $ rust +nightly hoge.rs | |
| # $ rust -e '1 + 1' | |
| # $ cat /etc/passwd | rust -l '|line| print!("{}", line)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment