paligned

Crates.iopaligned
lib.rspaligned
version0.1.0
created_at2024-12-28 07:36:57.368294+00
updated_at2024-12-28 07:36:57.368294+00
descriptionA simple macro for aligned printing
homepage
repositoryhttps://github.com/varonroy/paligned
max_upload_size
id1496908
size8,271
Roy Varon (varonroy)

documentation

https://docs.rs/crate/paligned/

README

License Crates.io Doc.rs

paligned

Simple macro for aligned printing.

use paligned::paligned;

paligned! ([
    ["expression","value", "description"],
    ["1 + 1 =", 1 + 1],
    ["foo:", @debug foo, "`@debug` example"],
]);
// expression value          description
// 1 + 1 =    2
// foo:       Foo { val: 1 } `@debug` example

The goal of this crate is to provide a simple, zero-configuration solution for printing several rows with aligned columns. Basically, an alternative to:

println!("expression value  description");
println!("1 + 1 = {}", 1 + 1);
println!("foo:    {:?}", foo);

This macro is minimal on purpose, if you need fancier printing, then (at the cost of extra verbosity) I would recommend:

Commit count: 1

cargo fmt