colprint
A lightweight Rust library for neatly printing data in aligned columns with automatic width calculation and customizable separators.
Features
- Simple API: Format complex data with an intuitive macro syntax
- Automatic Width Calculation: Columns automatically adjust to content size
- Custom Column Widths: Manually specify column widths when needed
- Flexible Formatting: Support for
Display,Debug, andPrettyDebugformatters - Custom Separators: Define any text as column separators
- Multi-line Support: Properly handles content with line breaks
- Unicode Compatible: Works correctly with multi-byte characters
Installation
Add this to your Cargo.toml:
[]
= "0.0.0"
Usage
Basic Usage
use colprint;
Alice | 30
Display vs Debug Formatting
The colprint! macro is most useful when printing complex (multi-line) data structures:
use colprint;
Name: Bob Name: Jessica
Age: 25 Age: 28
Country: Canada Country: USA
Job Data Scientist Job Software Engineer
Hobby Photography Hobby Hiking
Also supports debug formatting:
colprint!;
Person { Person {
name: "Bob", name: "Jessica",
age: 25, age: 28,
country: "Canada", country: "USA",
job: "Data Scientist", job: "Software Engineer",
hobby: "Photography", hobby: "Hiking",
} }
License
This project is licensed under the MIT License - see the LICENSE file for details.