nrc / derive-new

derive simple constructor functions for Rust structs
MIT License
525 stars 35 forks source link

error: calls in constants are limited to constant functions, struct and enum constructors #29

Open Boscop opened 6 years ago

Boscop commented 6 years ago

error: calls in constants are limited to constant functions, struct and enum constructors

How can I make the generated new() constructor const-fn? E.g.:

#[derive(new, Copy, Clone)]
pub struct ColorHB {
    hue: Hue,
    #[new(value = "1.")]
    brightness: f32,
}
Boscop commented 3 years ago

@nrc Can you please make the generated new method a const-fn? :)