Home > 備忘録 > 言語関連 > rust に関すること > rust のインストール( 40 )
[root@server]# dnf install rust cargo[root@server]# cargo new hello --bin // 新規プロジェクトを作成する
[root@server]# cargo build // コンパイルだけ行う
[root@server]# cargo run // コンパイルして実行する
[root@server]# cargo build --release // リリース用のコンパクトで高速なバイナリを作成する[root@server]# cd /xxx/yyyy[root@/yyyy]# cargo new hello --bin/xxx/yyyy/src/hello.rs
fn main() {
println!"Hello, world!");
}[root@/yyyy]# cargo run[root@server]# cargo --help
Rust's package manager
USAGE:
cargo [OPTIONS] [SUBCOMMAND]
OPTIONS:
-V, --version Print version info and exit
--list List installed commands
--explain <CODE> Run `rustc --explain CODE`
-v, --verbose Use verbose output (-vv very verbose/build.rs output)
-q, --quiet No output printed to stdout
--color <WHEN> Coloring: auto, always, never
--frozen Require Cargo.lock and cache are up to date
--locked Require Cargo.lock is up to date
--offline Run without accessing the network
-Z <FLAG>... Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details
-h, --help Prints help information
Some common cargo commands are (see all commands with --list):
build, b Compile the current package
check, c Analyze the current package and report errors, but don't build object files
clean Remove the target directory
doc Build this package's and its dependencies' documentation
new Create a new cargo package
init Create a new cargo package in an existing directory
run, r Run a binary or example of the local package
test, t Run the tests
bench Run the benchmarks
update Update dependencies listed in Cargo.lock
search Search registry for crates
publish Package and upload this package to the registry
install Install a Rust binary. Default location is $HOME/.cargo/bin
uninstall Uninstall a Rust binary
See 'cargo help <command>' for more information on a specific command.