LoginSignup
0
0

More than 1 year has passed since last update.

Rustに触れてみたい! ~第1回 ダウンロード編~

Posted at

Windows環境で書いていますが走らせるコマンドはほとんど同じなので適宜読み替えてください!

1. こう言う方に読んでもらいたい!

  • 難しい事は一旦置いておいてRustを触ってみたいという方
  • 文章を読むのが苦手な方

この記事を読んでもらうとRustをダウンロードできるようになります!
Rustは本当に面白いプログラミング言語なのでこの記事で触れてみて面白いなと思われたら他の記事や本が巷にはたくさんありますのでぜひ手に取ってRustの世界に足を踏み入れてください!

2. 始めるにあたって必要な知識

  • CMDやターミナル等を開ける
  • cdやcurl等の基本的なコマンドを使える

3. ダウンロードしてみよう!

DLするには、https://rustup.rs/ に行きます。
画像はWindowsで遷移した場合の画面です。
image-20211209102317738.png
上記ページからWindows環境なら rustup-init.exe をWSL等でLinuxを使用されている場合は curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shを実行します。

4. Hello World!

プログラミング言語を始めるとまず行いたいのがHelloWorldです!
Rustをインストールした時に一緒にCargoがインストールされているのでこちらを使って行いたいと思います!

path\to\rust\project>dir

 path\to\rust\project のディレクトリ

2021/12/09  10:30    <DIR>          .
2021/12/09  10:30    <DIR>          ..
               0 個のファイル                   0 バイト
               2 個のディレクトリ  106,362,707,968 バイトの空き領域

path\to\rust\project>cargo new hello
     Created binary (application) `hello` package

path\to\rust\project>dir

 path\to\rust\project のディレクトリ

2021/12/09  10:33    <DIR>          .
2021/12/09  10:33    <DIR>          ..
2021/12/09  10:33    <DIR>          hello
               0 個のファイル                   0 バイト
               3 個のディレクトリ  106,362,703,872 バイトの空き領域

path\to\rust\project>cd hello

path\to\rust\project\hello>cargo run
   Compiling hello v0.1.0 (path\to\rust\project\hello)
    Finished dev [unoptimized + debuginfo] target(s) in 2.85s
     Running `target\debug\hello.exe`
Hello, world!

path\to\rust\project\hello>

このように作成したい場所に遷移して
cargo new hello helloプロジェクトを作成
cd hello helloプロジェクトに移動
cargo run helloプロジェクトを実行
という三つのコマンドでHelloWorldを実行できました。

これにてダウンロード編完結です!

次回からはより深くrustと触れ合っていける記事を書いていきます。
読んでくださりありがとうございました!
コメントお待ちしています!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0