rust-typed-builder
rust-typed-builder copied to clipboard
Code cleanup. Make build method generate as const
- Add
#![forbid(rust_2018_idioms)]to thetyped-builder-macrocrate - Make the builder function const when possible
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?
Given how the setter methods are not
const, and thebuildmethod is notconst, is it really useful to make thebuildermethodconst?
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
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.