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

@ -1,7 +1,7 @@
//! Helper functions to create pure widgets.
use crate::overlay;
use crate::widget;
use crate::{Element, Length};
use crate::{Element, Length, Pixels};
use std::borrow::Cow;
use std::ops::RangeInclusive;
@ -247,21 +247,23 @@ pub fn image<Handle>(handle: impl Into<Handle>) -> widget::Image<Handle> {
/// Creates a new horizontal [`Space`] with the given [`Length`].
///
/// [`Space`]: widget::Space
pub fn horizontal_space(width: Length) -> widget::Space {
pub fn horizontal_space(width: impl Into<Length>) -> widget::Space {
widget::Space::with_width(width)
}
/// Creates a new vertical [`Space`] with the given [`Length`].
///
/// [`Space`]: widget::Space
pub fn vertical_space(height: Length) -> widget::Space {
pub fn vertical_space(height: impl Into<Length>) -> widget::Space {
widget::Space::with_height(height)
}
/// Creates a horizontal [`Rule`] with the given height.
///
/// [`Rule`]: widget::Rule
pub fn horizontal_rule<Renderer>(height: u16) -> widget::Rule<Renderer>
pub fn horizontal_rule<Renderer>(
height: impl Into<Pixels>,
) -> widget::Rule<Renderer>
where
Renderer: crate::Renderer,
Renderer::Theme: widget::rule::StyleSheet,
@ -272,7 +274,9 @@ where
/// Creates a vertical [`Rule`] with the given width.
///
/// [`Rule`]: widget::Rule
pub fn vertical_rule<Renderer>(width: u16) -> widget::Rule<Renderer>
pub fn vertical_rule<Renderer>(
width: impl Into<Pixels>,
) -> widget::Rule<Renderer>
where
Renderer: crate::Renderer,
Renderer::Theme: widget::rule::StyleSheet,