https://github.com/ksxgithub/text-block-macros
Create a multiline string literal
https://github.com/ksxgithub/text-block-macros
crate library literal macros multiline no-std rust rust-patterns string
Last synced: 4 months ago
JSON representation
Create a multiline string literal
- Host: GitHub
- URL: https://github.com/ksxgithub/text-block-macros
- Owner: KSXGitHub
- License: mit
- Created: 2021-04-08T10:34:58.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2025-02-24T17:36:14.000Z (12 months ago)
- Last Synced: 2025-02-24T18:32:38.665Z (12 months ago)
- Topics: crate, library, literal, macros, multiline, no-std, rust, rust-patterns, string
- Language: Rust
- Homepage: https://crates.io/crates/text-block-macros
- Size: 33.2 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# Text Block Macros
[](https://github.com/KSXGitHub/text-block-macros/actions?query=workflow%3ATest)
[](https://crates.io/crates/text-block-macros)
Create a multiline string literal.
## Usage Examples
### Create a block of text without final newline
```rust
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
```rust
use text_block_macros::text_block_fnl;
let text = text_block_fnl! {
"abc"
"def"
"ghi"
};
assert_eq!(text, "abc\ndef\nghi\n");
```
## License
[MIT](https://git.io/JYptO) © [Hoàng Văn Khải](https://github.com/KSXGitHub/).