RibirX/Ribir

Ribir style structure initialization support `const`

sologeek opened this issue · 0 comments

Is your feature request related to a problem? Please describe.
I want to define base common style in my project. like this:

// style.rs
pub static COMMON_RADIUS: Radius = Radius::all(8.) 

But Radius::all can't support const define.

Describe the solution you'd like
Support const in style structure initialization

impl Radius {
  #[inline]
  pub const fn new(top_left: f32, top_right: f32, bottom_left: f32, bottom_right: f32) -> Radius {
    Radius {
      top_left,
      top_right,
      bottom_left,
      bottom_right,
    }
  }

  /// Creates a radius where all radii are radius.
  #[inline]
  pub const fn all(radius: f32) -> Radius { Self::new(radius, radius, radius, radius) }```

**Describe alternatives you've considered**
Skip...

**Additional context**
Nope...