Closed SergeyKasmy closed 1 year ago
I removed the const
modifier because it was not possible to apply it to all methods of Style
— add_modifier
and remove_modifier
are operating on bitflags
structs which has no support for const
as far as I understood. I thought that providing only half the API as const would be more confusing. We can maybe revisit this when const
support lands in bitflags
, WDYT ?
You can inline the implementations to make them const:
https://github.com/fdehau/tui-rs/compare/master...sigmaSd:const?expand=1
Also I noticed that running cargo clippy -- -D clippy::missing_const_for_fn
shows that a lot more can be const
Actually tests are failing, I'll have to check more
Was a typo, fixed now
Description
I was looking for a way to create a const Style at the root of the file, so it would be easier to share styles between different UI elements and so I would only need to change it just in one place to have it apply everywhere. I found this issue #223 and its corresponding PR #226 which shows it has already been implemented in commit 808a5c9. But when I looked into
style.rs
these changes where nowhere to be found. I bisected this change to commit 0ffea49. My questions are: was that intended? Is there any reason for these changed to be removed? I would submit a PR to make them const again but it was probably removed for a reason after all, so I decided to ask about it first.Example