Implement From<u32> instead of u16 for Length and Pixels

This commit is contained in:
Héctor Ramón Jiménez 2025-02-09 06:38:48 +01:00
parent ab236376a3
commit f3ae4266e9
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
6 changed files with 23 additions and 26 deletions

View file

@ -77,8 +77,8 @@ impl From<f32> for Length {
}
}
impl From<u16> for Length {
fn from(units: u16) -> Self {
Length::Fixed(f32::from(units))
impl From<u32> for Length {
fn from(units: u32) -> Self {
Length::Fixed(units as f32)
}
}

View file

@ -20,9 +20,9 @@ impl From<f32> for Pixels {
}
}
impl From<u16> for Pixels {
fn from(amount: u16) -> Self {
Self(f32::from(amount))
impl From<u32> for Pixels {
fn from(amount: u32) -> Self {
Self(amount as f32)
}
}