diff options
author | 2024-02-21 07:23:12 +0100 | |
---|---|---|
committer | 2024-02-21 07:23:12 +0100 | |
commit | 5ba818a13aa99aa6bf00e360f68140b6df2d270f (patch) | |
tree | 197004a8aa09180704b83bce1ce653959a6e6990 | |
parent | c0c5a01079b39a1d831f0a80d6f2ee7f539a1673 (diff) | |
parent | 65f36f246a0f16e627c8a2ee5c02b4533e2dd2d7 (diff) | |
download | iced-5ba818a13aa99aa6bf00e360f68140b6df2d270f.tar.gz iced-5ba818a13aa99aa6bf00e360f68140b6df2d270f.tar.bz2 iced-5ba818a13aa99aa6bf00e360f68140b6df2d270f.zip |
Merge pull request #2274 from iced-rs/more-from-for-border-radius
`From<u16>` and `From<i32>` implementations for `border::Radius`
Diffstat (limited to '')
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | core/src/border.rs | 14 |
2 files changed, 14 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index bea24a28..0ff082fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/core/src/border.rs b/core/src/border.rs index 21823341..64262471 100644 --- a/core/src/border.rs +++ b/core/src/border.rs @@ -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) } } |