じゃあ、おうちで学べる

本能を呼び覚ますこのコードに、君は抗えるか

ConoHa WING にRust を入れてbuild環境を作る.

Rustをインストール

$ curl https://sh.rustup.rs -sSf | sh
$ls $HOME/.cargo/bin
cargo  cargo-clippy  cargo-fmt  rls  rust-gdb  rust-lldb  rustc  rustdoc  rustfmt  rustup
$cp $HOME/.cargo/bin/* $HOME/bin

Rust 実行する

$ cargo new hello_world --bin
     Created binary (application) `hello_world` project
$ cd hello_world/
$ ls
Cargo.toml  src

Cargo.toml

[package]
name = "hello_world"
version = "0.1.0"
authors = ["******"]

[dependencies]

src/main.rs

fn main() {
    println!("Hello, world!");
}

実行

$ cargo run
   Compiling hello_world v0.1.0 ( $HOME/rust/hello_world)
    Finished dev [unoptimized + debuginfo] target(s) in 0.36s
     Running `target/debug/hello_world`
Hello, world!

buildする

$ cargo build --release
$ ./target/release/hello_world
Hello, world!

参照

Hello, Cargo!
Customizing Builds with Release Profiles - The Rust Programming Language
Conoha Wing にGolangを入れてbuild環境を作る. - じゃあ、おうちで学べる