书栈网 · BookStack 本次搜索耗时 0.015 秒,为您找到 587 个相关结果.
  • 安装 nightly rust

    安装 nightly Rust 安装 nightly Rust 代码 我们首先使用如下命令安装 Rust 工具链管理器 rustup 和 Rust 包管理器 cargo: $ curl https : //sh.rustup.rs -sSf | sh 如果安装 rust 的过程中出现了困难,可以阅读 附录:安装 rust Ru...
  • crate

    crate crate crate_type 属性可以告知编译器 crate 是一个二进制的可执行文件还是一个库(甚至是哪种类型的库),crate_time 属性可以设定 crate 的名称。 // 这个 crate 是一个库文件 #![crate_type = "lib"] // 库的名称为 “rary” #![crate_...
  • 测试

    测试 参见: 测试 函数可以通过这些属性 (attribute) 进行测试: #[test] 将一个函数标记为一个单元测试。该函数不能接受参数且返回空。 #[should_panic] 将一个函数标记为 panic 测试。 // 当且仅当测试套件没有运行时,才条件编译 `main` 函数。 #[cfg(not(test))] fn...
  • Hello World

    Hello World 动手试一试 Hello World 这是传统的 Hello World 程序的源码。 // 这是注释内容,将会被编译器忽略掉 // 可以单击前面的按钮 "Run" 来测试这段代码 -> // 若想用键盘操作,可以使用快捷键"Ctrl + Enter"来运行 // 这段代码支持编辑,你可以自由地改进代码! ...
  • 6.6.链接进阶

    链接进阶 链接参数(Link args) 静态链接 Linux 链接进阶 advanced-linking.md commit 226bcdf7d1e774f5967f92b0bd0bf237179f95c9 Rust 的常用链接形式在本书的之前部分已经介绍过了,不过支持多种其他语言可用的可能的链接对 Rust 获取与原生库的无缝交互是...
  • 9.1. Unrecoverable Errors with panic!

    Unrecoverable Errors with panic! Unwinding the Stack or Aborting in Response to a Panic Using a panic! Backtrace Unrecoverable Errors with panic! Sometimes, bad things h...
  • Crates

    Crates Crates The crate_type attribute can be used to tell the compiler whether a crate isa binary or a library (and even which type of library), and the crate_name attribute ...
  • 3.5. Build Scripts

    1036 2019-11-19 《The Cargo Book v0.40》
    Build Scripts Inputs to the Build Script Outputs of the Build Script Build Dependencies The links Manifest Key Overriding Build Scripts Case study: Code generation Case study...
  • 2.3. Running Cargo Locally

    Running Code Locally with Cargo Running Code Locally with Cargo If you want to experiment with the code on your own system, then you will need to first install Rust. Do this by...