derive-new icon indicating copy to clipboard operation
derive-new copied to clipboard

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

Open Boscop opened this issue 7 years ago • 1 comments

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 avatar Mar 02 '18 23:03 Boscop

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

Boscop avatar Mar 09 '21 17:03 Boscop