#string-literal #literals #string #text #block #multi-line

no-std text-block-macros

Create a multiline string literal

4 releases (2 breaking)

new 0.2.0 Oct 29, 2024
0.1.2 Oct 29, 2024
0.1.1 May 8, 2021
0.1.0 Apr 8, 2021
0.0.0 Apr 8, 2021

#328 in Rust patterns

Download history 1398/week @ 2024-07-15 858/week @ 2024-07-22 1150/week @ 2024-07-29 878/week @ 2024-08-05 420/week @ 2024-08-12 579/week @ 2024-08-19 587/week @ 2024-08-26 569/week @ 2024-09-02 459/week @ 2024-09-09 517/week @ 2024-09-16 612/week @ 2024-09-23 396/week @ 2024-09-30 539/week @ 2024-10-07 679/week @ 2024-10-14 756/week @ 2024-10-21 1174/week @ 2024-10-28

3,172 downloads per month
Used in 10 crates (4 directly)

MIT license

4KB

Text Block Macros

Test Crates.io Version

Create a multiline string literal.

Usage Examples

Create a block of text without final newline

use text_block_macros::text_block;
let text = text_block! {
  "abc"
  "def"
  "ghi"
};
assert_eq!(text, "abc\ndef\nghi");

Create a block of text that ends with a newline

use text_block_macros::text_block_fnl;
let text = text_block_fnl! {
  "abc"
  "def"
  "ghi"
};
assert_eq!(text, "abc\ndef\nghi\n");

License

MIT © Hoàng Văn Khải.

No runtime deps