unindent/
lib.rs

1//! [![github]](https://github.com/dtolnay/indoc) [![crates-io]](https://crates.io/crates/unindent) [![docs-rs]](https://docs.rs/unindent)
2//!
3//! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github
4//! [crates-io]: https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge&labelColor=555555&logo=rust
5//! [docs-rs]: https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge&labelColor=555555&logo=docs.rs
6//!
7//! <br>
8//!
9//! ## Unindent
10//!
11//! This crate provides [`indoc`]'s indentation logic for use with strings that
12//! are not statically known at compile time. For unindenting string literals,
13//! use `indoc` instead.
14//!
15//! [`indoc`]: https://github.com/dtolnay/indoc
16//!
17//! This crate exposes two unindent functions and an extension trait:
18//!
19//! - `fn unindent(&str) -> String`
20//! - `fn unindent_bytes(&[u8]) -> Vec<u8>`
21//! - `trait Unindent`
22//!
23//! ```
24//! use unindent::unindent;
25//!
26//! fn main() {
27//!     let indented = "
28//!             line one
29//!             line two";
30//!     assert_eq!("line one\nline two", unindent(indented));
31//! }
32//! ```
33//!
34//! The `Unindent` extension trait expose the same functionality under an
35//! extension method.
36//!
37//! ```
38//! use unindent::Unindent;
39//!
40//! fn main() {
41//!     let indented = format!("
42//!             line {}
43//!             line {}", "one", "two");
44//!     assert_eq!("line one\nline two", indented.unindent());
45//! }
46//! ```
47
48#![doc(html_root_url = "https://docs.rs/unindent/0.2.3")]
49#![allow(
50    clippy::missing_panics_doc,
51    clippy::module_name_repetitions,
52    clippy::must_use_candidate,
53    clippy::needless_doctest_main,
54    clippy::trivially_copy_pass_by_ref,
55    clippy::type_complexity
56)]
57
58mod unindent;
59
60pub use crate::unindent::*;