Debian Codegraph @

README.md

raw symbols SCIP
1 <!--
2 SPDX-FileCopyrightText: 2021 ilkecan <[email protected]>
3
4 SPDX-License-Identifier: MPL-2.0
5 -->
6
7 # indent
8
9 [![Crates.io](https://img.shields.io/crates/v/indent?style=for-the-badge)](https://crates.io/crates/indent/)
10 [![Crates.io](https://img.shields.io/crates/l/indent?style=for-the-badge)](https://www.mozilla.org/en-US/MPL/2.0/)
11 [![docs.rs](https://img.shields.io/docsrs/indent?style=for-the-badge)](https://docs.rs/indent/)
12 [![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/cargo/indent?style=for-the-badge)](https://libraries.io/cargo/indent)
13 [![Lines of code](https://img.shields.io/tokei/lines/git.sr.ht/~ilkecan/indent-rs?style=for-the-badge)](https://github.com/XAMPPRocky/tokei)
14 [![REUSE Compliance](https://img.shields.io/reuse/compliance/git.sr.ht/~ilkecan/indent-rs?style=for-the-badge)](https://api.reuse.software/info/git.sr.ht/~ilkecan/indent-rs)
15
16 This crate provides 4 functions useful for inserting a multiline string into an
17 already indented context in another string:
18
19 - `indent_by`: Indents every line that is not empty by the given number of spaces,
20 starting from the second line.
21 - `indent_with`: Indents every line that is not empty with the given prefix,
22 starting from the second line.
23 - `indent_all_by`: Indents every line that is not empty by the given number of spaces.
24 - `indent_all_with`: Indents every line that is not empty with the given prefix.
25
26 ## Examples
27 ```rust
28 fn main() {
29 let string = "line one
30
31 line two
32 ";
33 assert_eq!("line one\n\n line two\n", indent::indent_by(2, string));
34 }
35 ```
36
37 ## License
38 [Mozilla Public License 2.0](LICENSE.txt)
39
40 ## Contribution
41 Unless you explicitly state otherwise, any contribution intentionally submitted
42 for inclusion in the work by you shall be licensed under the Mozilla Public
43 License 2.0, without any additional terms or conditions.