#string-literal #string #multiline #literals #heredoc

stripmargin

Simple but elegant multiline string in Rust à la Scala

2 releases

0.1.1 Jan 17, 2021
0.1.0 Jan 16, 2021

#10 in #multiline

Download history 995/week @ 2024-11-13 996/week @ 2024-11-20 907/week @ 2024-11-27 897/week @ 2024-12-04 432/week @ 2024-12-11 514/week @ 2024-12-18 211/week @ 2024-12-25 119/week @ 2025-01-01 698/week @ 2025-01-08 570/week @ 2025-01-15 212/week @ 2025-01-22 672/week @ 2025-01-29 318/week @ 2025-02-05 138/week @ 2025-02-12 194/week @ 2025-02-19 64/week @ 2025-02-26

796 downloads per month
Used in 2 crates

MIT license

5KB

stripmargin

Downloads License crates.io docs.rs

A little Rust library that enables you to write multiline strings à la Scala.

Usage

use stripmargin::StripMargin;

// Use '|' to set left margin, 
// and then `.strip_margin()` :)
```rust
assert_eq!(
    r#"Hello,
      |  world!
      |"#
    .strip_margin(),
    "Hello,\n  world!\n",
);

lib.rs:

A little Rust library that enables you to write multiline strings à la Scala.

No runtime deps