Crate textwrap_macros

source ·
Expand description

Simple procedural macros to use textwrap utilities at compile time.

TravisCI Codecov License Source Crate Documentation Changelog

Usage

Either use the macros using the old-style #[macro_use] or import them as any other crate member:

use textwrap_macros::dedent;

const poem: &str = dedent!(r#"
      When we two parted
      In silence and tears,
      Half broken-hearted
      To sever for years,
      Pale grew thy cheek and cold,
      Colder thy kiss;
      Truly that hour foretold
      Sorrow to this.
"#);

Checkout the documentation of the original library for more information about the behaviour of each of the wrapped functions.

Changelog

This project adheres to Semantic Versioning and provides a changelog in the Keep a Changelog format.

Macros

Removes common leading whitespace from each line.
Fill a line of text at width characters.
Add prefix to each non-empty line.
Refill a paragraph of wrapped text with a new width.
Unpack a paragraph of already-wrapped text.
Wrap a line of text at width characters.