const_panic/
doc_macros.rs

1macro_rules! formatting_docs {($($additional_fmt_overrides:expr)?) => {
2concat!(r##"
3# Formatting
4
5Literals are Display formatted by default, so that you can pass string literals 
6without worrying about what the current formatting settings are.
7
8Expressions are formatted as determined by the `$fmtarg` argument.
9
10Note that literals inside parentheses (eg: `(100)`) are considered expressions
11by this macro.
12
13### Formatting overrides
14
15You can override how an argument is formatted by prefixing the argument expression with 
16any of the options below:
17- `debug:` or `{?}:`: `Debug` formats the argument.
18- `alt_debug:` or `{#?}:`: alternate-`Debug` formats the argument.
19- `display:` or `{}:`: `Display` formats the argument.
20- `alt_display:` or `{#}:`: alternate-`Display` formats the argument.
21- `bin:` or `{b}:`: `Debug` formats the argument, with binary-formatted numbers.
22- `alt_bin:` or `{#b}:`:
23alternate-`Debug` formats the argument, with binary-formatted numbers.
24- `hex:` or `{X}:`:
25`Debug` formats the argument, with hexadecimal-formatted numbers.
26- `alt_hex:` or `{#X}:`:
27alternate-`Debug` formats the argument, with hexadecimal-formatted numbers.
28"##,
29$($additional_fmt_overrides,)?
30r##"
31### String formatting
32
33String expressions are debug-formatted like this:
34- Prepending and appending the double quote character (`"`).
35- Escaping the `'\t'`,`'\n'`,`'\r'`,`'\\'`, `'\''`, and`'\"'` characters.
36- Escaping control characters with `\xYY`, 
37where `YY` is the hexadecimal value of the control character.
38
39"##
40)}}
41
42macro_rules! limitation_docs {() => {
43"
44Arguments to the formatting/panicking macros must have a fully inferred concrete type, 
45because `const_panic` macros use duck typing to call methods on those arguments.
46
47One effect of that limitation is that you will have to pass suffixed 
48integer literals (eg: `100u8`) when those integers aren't inferred to be a concrete type.
49"
50}}
51pub(crate) use limitation_docs;