Closed6

Rustの環境構築をする(mac・asdf)

strtstrt

Rust

% asdf plugin-add rust https://github.com/asdf-community/asdf-rust.git
% asdf list all rust
% asdf install rust 1.77.0 # rust 1.77.0 is already installedだった
% asdf local rust 1.77.0

Python

% asdf plugin add python https://github.com/danhper/asdf-python.git # Plugin named python already addedだった
% asdf list all python
% asdf install python 3.12.2 # python 3.12.2 is already installedだった
% asdf local python 3.12.2
strtstrt

入ってるか確認

% python -V
Python 3.12.2
% rustc -V
rustc 1.77.0 (aedd173a2 2024-03-17)
% cargo --version
cargo 1.77.0 (3fe68eabf 2024-02-29)

入ってそう

strtstrt

Rust側ちゃんとできるかテスト

% mkdir rust
% cd rust
% touch hello.rs
  • hello.rs
fn main() {
    println!("Hello, World!")
}
% rustc hello.rs
% ./hello
Hello, World!
strtstrt

一応Python側も

% cd ../python
% touch hello.py
  • hello.py
print("Hello, World!")
python hello.py
Hello, World!

大丈夫そう

strtstrt

GitHubで管理しようと思ったら、helloまで行ってしまいそうだったので、一旦拡張子がないファイルはignoreすることにした
以下のように書けばいいらしい

* 
!*/
!*.*
このスクラップは2024/03/26にクローズされました