How can I write crate-wide documentation?

寵の児 提交于 2019-11-28 12:11:39
Matthieu M.

I found the hidden nugget in the book's Publishing a Crate to Crates.io section.

Regular documentation comments (starting with ///) document the next item, however a crate is nobody's next.

The solution is to switch to using another kind of comment, this time starting with //!, which documents the enclosing item.

And suddenly it works:

#![deny(missing_docs)]

//! Hello world example for Rust.

fn main() {
    println!("Hello world!");
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!