Use f32 in Length::Units and rename it to Fixed

This commit is contained in:
Héctor Ramón Jiménez 2023-02-04 12:24:13 +01:00
parent f75e020257
commit 7b8b01f560
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
43 changed files with 269 additions and 262 deletions

View file

@ -15,23 +15,26 @@ pub struct Space {
impl Space {
/// Creates an amount of empty [`Space`] with the given width and height.
pub fn new(width: Length, height: Length) -> Self {
Space { width, height }
pub fn new(width: impl Into<Length>, height: impl Into<Length>) -> Self {
Space {
width: width.into(),
height: height.into(),
}
}
/// Creates an amount of horizontal [`Space`].
pub fn with_width(width: Length) -> Self {
pub fn with_width(width: impl Into<Length>) -> Self {
Space {
width,
width: width.into(),
height: Length::Shrink,
}
}
/// Creates an amount of vertical [`Space`].
pub fn with_height(height: Length) -> Self {
pub fn with_height(height: impl Into<Length>) -> Self {
Space {
width: Length::Shrink,
height,
height: height.into(),
}
}
}