相关疑难解决方法(0)

如何编写crate-wide文档?

为了确保记录我的箱子的所有公共工件(如果最低限度开始),我#![deny(missing_docs)]在我的指定lib.rs,但它适得其反.

我希望编写这样的代码,即顶部的文档注释和后面的代码:

/// Hello world example for Rust.

#![deny(missing_docs)]

fn main() {
    println!("Hello world!");
}
Run Code Online (Sandbox Code Playgroud)

这失败了:

error: an inner attribute is not permitted following an outer doc comment
 --> src/main.rs:3:3
  |
3 | #![deny(missing_docs)]
  |   ^
  |
  = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.
Run Code Online (Sandbox Code Playgroud)

首先恢复订单,属性和第二个注释:

#![deny(missing_docs)]

/// Hello world example for Rust.

fn …
Run Code Online (Sandbox Code Playgroud)

documentation rust

11
推荐指数
1
解决办法
403
查看次数

标签 统计

documentation ×1

rust ×1