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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user