Skip to content

Could we get some form of Format Macro? #155

@EmeraldPandaTurtle

Description

@EmeraldPandaTurtle

It would be pretty cool to see a way to make a format with a macro!

Something Like

let format = table_format!(
// This could be the title format
// C would signify that the cell goes here
Title->{
   +===+===+
   | C | C |
   +===+===+
},
// The Other Formats
Row-> {
   +---+---+
   | C   C |
   +---+---+
}
);

// Then to make a table out of it
let mut table = table!(format, 
["Hello World!", "This is a cool format tool"]
);

table.set_titles(row!["Cool Title", "Part 2"]);

table.print_tty(true);

Which would result in

+==============+============================+
| Cool Title   | Part 2                     |
+==============+============================+
| Hello World! | This is a cool format tool |
+--------------+----------------------------+

I'm not remotely familiar with how macro writing would work, but would this be possible, I'm happy to work through it, if interested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions