From 950a7f7eaf4afaaa7492e6227bef81b238a526a8 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 21 Feb 2024 07:10:29 +0100 Subject: Add `From` and `From` for `border::Radius` --- core/src/border.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'core') 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 for Radius { impl From for Radius { fn from(w: u8) -> Self { - Self([f32::from(w); 4]) + Self::from(f32::from(w)) + } +} + +impl From for Radius { + fn from(w: u16) -> Self { + Self::from(f32::from(w)) + } +} + +impl From for Radius { + fn from(w: i32) -> Self { + Self::from(w as f32) } } -- cgit