Add From<u16> and From<i32> for border::Radius

This commit is contained in:
Héctor Ramón Jiménez 2024-02-21 07:10:29 +01:00
parent c0c5a01079
commit 950a7f7eaf
No known key found for this signature in database
GPG key ID: 0BF4EC06CD8E5686

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)
}
}