Giter VIP home page Giter VIP logo

Comments (4)

pinkforest avatar pinkforest commented on June 20, 2024

Could we sketch some examples of the desired minimal / ideal support(s) ?

from prettytable-rs.

samiraguiar avatar samiraguiar commented on June 20, 2024

Ideally it would be something like this:

pub fn bool_icon(v: bool) -> Cell {
    if v {
        cell![Fgb -> "✔"]
    } else {
        cell![Frb -> "✘"]
    }
}

...
subtable.add_row(row![ "Enabled?", bool_icon(d.can_connect) ]);
table.add_row(row![ "Details", subtable ]);
...

Or without macros if not possible. When it's not inside a subtable I can workaround it by not using macros:

table.add_row(Row::new(vec![
    Cell::new("Enabled?"),
    bool_icon(d.can_connect),
]));

But with a subtable this doesn't work because it is converted to a string without styles first.

from prettytable-rs.

pinkforest avatar pinkforest commented on June 20, 2024

Would you like to try a PR ?

from prettytable-rs.

samiraguiar avatar samiraguiar commented on June 20, 2024

Sure, I'd love to. I can't make promises on a time frame but I'll take a look when possible

from prettytable-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.