colprint

Macro colprint 

Source
macro_rules! colprint {
    ($fmt:expr, $($item:expr),* $(,)?) => { ... };
}
Expand description

Macro for printing items in columns using a format string.

The format string specifies how each item should be displayed:

  • {} for regular Display
  • {:?} for Debug
  • {:#?} for pretty Debug

You can also specify a width for each column by adding a colon and a number after the format:

  • {:80} for Display with width 80
  • {:?:60} for Debug with width 60
  • {:#?:100} for pretty Debug with width 100

Any text between format specifications will be used as column separators:

  • {} | {} will print a pipe with spaces between columns
  • {} {} will print two spaces between columns
  • {:?} -> {:#?} will print an arrow between columns

ยงExamples

// Basic usage with Display
colprint!("{}{}", item1, item2);

// Using Debug format with separators
colprint!("{:?} | {:?}", item1, item2);

// Using pretty Debug with specific widths and separators
colprint!("{:#?:80} || {:#?:60}", item1, item2);

// Mixed formats with decorative separators
colprint!("{} -> {:?} => {:#?}", item1, item2, item3);