rsmack_utils/doc.rs
1//! Some doc utils (not edoc related)
2
3/// `cl` stands for code link
4/// ```
5/// use rsmack_utils::cl;
6/// let result = cl!(proc_macro_error2::abort);
7/// assert_eq!(result, "[`proc_macro_error2::abort`]");
8/// let result_macro = cl!(proc_macro_error2::abort!);
9/// assert_eq!(result_macro, "[`proc_macro_error2::abort!`]");
10/// ```
11#[macro_export]
12macro_rules! cl {
13 ($id:ident!) => {
14 concat!(stringify!($id), "!")
15 };
16 ($($id:ident)::*!) => {
17 concat!("[`", cl!($($id)*!), "`]")
18 };
19 ($fst:ident $($id:ident)*!) => {
20 concat!(stringify!($fst), "::", cl!($($id)*!))
21 };
22 ($id:ident) => {
23 stringify!($id)
24 };
25 ($($id:ident)::*) => {
26 concat!("[`", cl!($($id)*), "`]")
27 };
28 ($fst:ident $($id:ident)*) => {
29 concat!(stringify!($fst), "::", cl!($($id)*))
30 };
31}