summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-02-21 07:23:12 +0100
committerLibravatar GitHub <noreply@github.com>2024-02-21 07:23:12 +0100
commit5ba818a13aa99aa6bf00e360f68140b6df2d270f (patch)
tree197004a8aa09180704b83bce1ce653959a6e6990 /core
parentc0c5a01079b39a1d831f0a80d6f2ee7f539a1673 (diff)
parent65f36f246a0f16e627c8a2ee5c02b4533e2dd2d7 (diff)
downloadiced-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--core/src/border.rs14
1 files changed, 13 insertions, 1 deletions
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)
}
}