Merge pull request #2274 from iced-rs/more-from-for-border-radius

`From<u16>` and `From<i32>` implementations for `border::Radius`
This commit is contained in:
Héctor Ramón 2024-02-21 07:23:12 +01:00 committed by GitHub
commit 5ba818a13a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View file

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `PartialOrd`, `Ord`, and `Hash` implementations for `keyboard::Modifiers`. [#2270](https://github.com/iced-rs/iced/pull/2270)
- `clipboard` module in `advanced` module. [#2272](https://github.com/iced-rs/iced/pull/2272)
- Default `disabled` style for `checkbox` and `hovered` style for `Svg`. [#2273](https://github.com/iced-rs/iced/pull/2273)
- `From<u16>` and `From<i32>` implementations for `border::Radius`. [#2274](https://github.com/iced-rs/iced/pull/2274)
### Fixed
- Black images when using OpenGL backend in `iced_wgpu`. [#2259](https://github.com/iced-rs/iced/pull/2259)

View file

@ -37,7 +37,19 @@ impl From<f32> for Radius {
impl From<u8> for Radius {
fn from(w: u8) -> Self {
Self([f32::from(w); 4])
Self::from(f32::from(w))
}
}
impl From<u16> for Radius {
fn from(w: u16) -> Self {
Self::from(f32::from(w))
}
}
impl From<i32> for Radius {
fn from(w: i32) -> Self {
Self::from(w as f32)
}
}