https://crates.io/crates/textwrap
The Rust Textwrap crate is a library for wrapping and formatting text in Rust. It provides a simple API for wrapping text to a specified width, as well as support for indentation, alignment, and hyphenation.
The Textwrap crate can be used for a variety of text formatting tasks, such as formatting text for display in a terminal, wrapping text for printing to a file, or formatting text for display in a GUI application.
Some of the key features of the Textwrap crate include:
-
Support for wrapping text to a specified width, with options for indenting and aligning the wrapped text.
-
Support for hyphenation, which can improve the readability of text by breaking long words across lines.
-
Support for custom line breaking rules, which can be used to handle special cases such as URLs or email addresses.
-
A simple and easy-to-use API, with sensible defaults that make it easy to get started with text wrapping in Rust.
-
Support for a variety of text input and output formats, including plain text, HTML, and Markdown.
Overall, the Rust Textwrap crate is a powerful tool for formatting and wrapping text in Rust. Its flexible API and support for advanced features like hyphenation and custom line breaking rules make it a great choice for developers looking to format text for a variety of applications.