text_block_macros/
lib.rs

1#![no_std]
2#![no_implicit_prelude]
3
4/// Create a multiline string literal.
5///
6/// **Example:**
7///
8/// ```
9/// # #![no_implicit_prelude]
10/// # use ::core::assert_eq;
11/// # use text_block_macros::text_block;
12/// let text = text_block! {
13///     "abc"
14///     "def"
15///     "ghi"
16/// };
17/// assert_eq!(text, "abc\ndef\nghi");
18/// ```
19#[macro_export]
20macro_rules! text_block {
21    () => {
22        ""
23    };
24
25    ($line:literal) => {
26        $line
27    };
28
29    ($head:literal $($tail:literal)*) => {
30        ::core::concat!($head, $("\n", $tail,)*)
31    };
32}
33
34/// Create a multiline string literal with a trailing newline.
35///
36/// **Example:**
37///
38/// ```
39/// # #![no_implicit_prelude]
40/// # use ::core::assert_eq;
41/// # use text_block_macros::text_block_fnl;
42/// let text = text_block_fnl! {
43///     "abc"
44///     "def"
45///     "ghi"
46/// };
47/// assert_eq!(text, "abc\ndef\nghi\n");
48/// ```
49#[macro_export]
50macro_rules! text_block_fnl {
51    ($($line:literal)*) => {
52        ::core::concat!($($line, "\n",)*)
53    };
54}
55
56#[doc = include_str!("README.md")]
57#[allow(unused)]
58mod readme {}
59
60#[doc = include_str!("specs.md")]
61#[allow(unused)]
62mod specs {}