GithubHelp home page GithubHelp logo

Comments (6)

pitkley avatar pitkley commented on September 17, 2024

Thanks for adding this issue, this is something I thought about while implementing the config-structs but didn't want to do in the same step. Very much 👍 on this!

from i3status-rust.

greshake avatar greshake commented on September 17, 2024

In an ideal case, it would boil down to macro-usage like this, but I'm not sure how to realize it without (or even with) nightly features:

pub struct Temperature {
    text: ButtonWidget,
    output: String,
    [Configurable(false)] // Not required
    collapsed: bool,
    id: String,
    [Configurable(true)] // Required
    update_interval: Duration,
}
...
fn new(config: Config, _tx_update_request: Sender<Task>) -> Result<Self> {
    let default = Temperature {
        ... // Add default values here, dummy values for those that are required anyway
    };
    return util::configure(default, config)
}

from i3status-rust.

svmnotn avatar svmnotn commented on September 17, 2024

@greshake uhmmm it might be possible but it would end up doing the same thing we are currently doing. AKA making a config struct and then using it to fill in the values.

from i3status-rust.

greshake avatar greshake commented on September 17, 2024

The thing I was trying to get at may be a slightly different issue; I think there is a lot of unnessesary boilerplate which might get reduced and increase readability.

from i3status-rust.

svmnotn avatar svmnotn commented on September 17, 2024

Maybe we should make a list of all the boiler plate and see what we can change using macros, and/or macros 1.1?
So far the config seems like the biggest boiler plate, but I didn't even notice it so I would like to know what you think could be improved @greshake.

from i3status-rust.

ammgws avatar ammgws commented on September 17, 2024

Closing due to inactivity

from i3status-rust.

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.