indent 0.1.1

Functions for indenting multiline strings
Documentation
  • Coverage
  • 100%
    5 out of 5 items documented4 out of 4 items with examples
  • Size
  • Source code size: 42.82 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.2 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ilkecan

indent

Crates.io Crates.io docs.rs Libraries.io dependency status for latest release Lines of code REUSE Compliance

This crate provides 4 functions useful for inserting a multiline string into an already indented context in another string:

  • indent_by: Indents every line that is not empty by the given number of spaces, starting from the second line.
  • indent_with: Indents every line that is not empty with the given prefix, starting from the second line.
  • indent_all_by: Indents every line that is not empty by the given number of spaces.
  • indent_all_with: Indents every line that is not empty with the given prefix.

Examples

fn main() {
    let string = "line one

line two
";
    assert_eq!("line one\n\n  line two\n", indent::indent_by(2, string));
}

License

Mozilla Public License 2.0

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be licensed under the Mozilla Public License 2.0, without any additional terms or conditions.