1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 05:10:03 -04:00

Convenience const fn for Margin, Rounding and Shadow (#4080)

I often write constants at the top of my widget files, as a "config". I
kept writing stuff like that :
```rust
const DEFAULT_INNER_MARGIN: Margin = Margin { left: 17., right: 17., top: 7., bottom: 7. };
```
So I prefixed constructors for `Margin`, `Rounding` and `Shadow` const.
No code was changed.

I also added a `Shadow::new()` for similar reasons.
This commit is contained in:
0Qwel
2024-02-21 16:20:26 +01:00
committed by GitHub
parent cdb7d153dc
commit 23e8312fc0
3 changed files with 13 additions and 9 deletions

View File

@@ -701,7 +701,7 @@ impl Rounding {
};
#[inline]
pub fn same(radius: f32) -> Self {
pub const fn same(radius: f32) -> Self {
Self {
nw: radius,
ne: radius,