#literals

stripmargin

Simple but elegant multiline string in Rust à la Scala

2 releases

0.1.1 Jan 17, 2021
0.1.0 Jan 16, 2021

#45 in #literals

Download history 643/week @ 2024-07-22 882/week @ 2024-07-29 1107/week @ 2024-08-05 496/week @ 2024-08-12 461/week @ 2024-08-19 741/week @ 2024-08-26 353/week @ 2024-09-02 566/week @ 2024-09-09 516/week @ 2024-09-16 1063/week @ 2024-09-23 622/week @ 2024-09-30 531/week @ 2024-10-07 956/week @ 2024-10-14 590/week @ 2024-10-21 949/week @ 2024-10-28 1020/week @ 2024-11-04

3,553 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