idanarye / rust-typed-builder

Compile-time type-checked builder derive
https://crates.io/crates/typed-builder
Apache License 2.0
904 stars 52 forks source link

Code cleanup. Make build method generate as const #123

Open DanikVitek opened 10 months ago

DanikVitek commented 10 months ago
idanarye commented 10 months ago

Given how the setter methods are not const, and the build method is not const, is it really useful to make the builder method const?

DanikVitek commented 10 months ago

Given how the setter methods are not const, and the build method is not const, is it really useful to make the builder method const?

Not really. I'm not sure if it would be possible because of deconstruction of self. Currently it's not possible in const fn afaik

idanarye commented 10 months ago

Once https://github.com/rust-lang/rust/issues/67792 gets stabilized, builder, build, and all the setters could be const - and that would be controlled via a flag on the attribute (#84). Until then, I see no point in making only the builder method const.