cargo new —lib filename

    cargo new filename

    rustc main.rs

    cargo build 编译

    cargo run 编译并运行

    cargo check 检查文件正确性 不生成可执行文件 快速

    cargo build —release 准备发布时使用 这样做会使rust代码运行更快 cargo doc —open 命令来构建所有本地依赖提供的文档,并在浏览器中打开。方便了解包所调用的方法 cargo update 更新包 但不更新大版本 例如 rand crate 发布了两个新版本,0.5.60.6.0
    1. $ cargo update
    2. Updating crates.io index
    3. Updating rand v0.5.5 -> v0.5.6
    4. // 如果想要使用 0.6.0 版本的 rand 或是任何 0.6.x 系列的版本,必须像这样更新 Cargo.toml 文件:
    5. [dependencies]
    6. rand = "0.6.0"