doc_for
📖 Get the documentation comment for a type.
🤔 Usage
First, bring DocFor and doc_for! into scope:
use ;
Then, derive the DocFor trait for your type:
# use ;
#
/// Some documentation
Finally, use the doc_for! macro to get the documentation comment:
# use ;
#
# /// Some documentation
#
#
assert_eq!;
Note that the leading spaces are preserved. Multi-line comments are also supported:
# use ;
#
/// Some documentation
/// that spans multiple lines
///
/// Additional information
assert_eq!;
Also works with tuple structs, enums and unions:
# use ;
#
/// Tuple struct documentation
;
assert_eq!;
/// Enum documentation
assert_eq!;
/// Union documentation
union MyUnion
assert_eq!;
✅ TODO
- Access module documentation (e.g.
doc_for!(my_module)) - Access trait documentation (e.g.
doc_for!(MyTrait)) - Access sub-item documentation
- Access field documentation (e.g.
doc_for!(MyStruct::field)) - Access method documentation (e.g.
doc_for!(MyStruct::method)) - Access associated constant documentation (e.g.
doc_for!(MyStruct::CONSTANT)) - Access associated type documentation (e.g.
doc_for!(MyStruct::Type)) - Access enum variant documentation (e.g.
doc_for!(MyEnum::Variant))
- Access field documentation (e.g.