summaryrefslogtreecommitdiffstats
path: root/native/src/widget/helpers.rs
diff options
context:
space:
mode:
Diffstat (limited to 'native/src/widget/helpers.rs')
-rw-r--r--native/src/widget/helpers.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/native/src/widget/helpers.rs b/native/src/widget/helpers.rs
index dfd949f6..d13eca75 100644
--- a/native/src/widget/helpers.rs
+++ b/native/src/widget/helpers.rs
@@ -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,