15 releases

Uses old Rust 2015

0.4.1 Jul 1, 2020
0.4.0 Jul 1, 2020
0.3.4 Oct 24, 2025
0.3.3 Mar 17, 2020
0.1.2 Mar 29, 2018

#221 in Rust patterns

Download history 1051348/week @ 2026-02-14 1153596/week @ 2026-02-21 1439320/week @ 2026-02-28 1398551/week @ 2026-03-07 1155164/week @ 2026-03-14 998161/week @ 2026-03-21 1055337/week @ 2026-03-28 1116679/week @ 2026-04-04 1139581/week @ 2026-04-11 1207142/week @ 2026-04-18 1157327/week @ 2026-04-25 1016582/week @ 2026-05-02 1179015/week @ 2026-05-09 1183044/week @ 2026-05-16 1125297/week @ 2026-05-23 1205348/week @ 2026-05-30

4,851,917 downloads per month
Used in 2,215 crates (418 directly)

MIT license

10KB
56 lines

doc-comment

Write doc comments from macros.

Please note that calling macros in doc attribute was added in Rust 1.54 so unless you need to support older Rust versions, you don't need this crate and you can do the same thing with:

#[cfg_attr(doctest, doc = include_str!("../README.md"))]

Usage example

// Of course, we need to import the `doc_comment` macro:
#[macro_use]
extern crate doc_comment;

// If you want to test examples in your README file.
doctest!("../README.md");

// If you want to test your README file ONLY on "cargo test":
#[cfg(doctest)]
doctest!("../README.md");

// If you want to document an item:
doc_comment!(concat!("fooo", "or not foo"), pub struct Foo {});

For more information, take a look at the documentation.

No runtime deps