diff options
author | 2023-02-04 12:24:13 +0100 | |
---|---|---|
committer | 2023-02-17 15:40:17 +0100 | |
commit | 7b8b01f560569ae18d9337a31ba94f6c1c2ba0dd (patch) | |
tree | ac9aac5eb82f175990da17813985d2f864897080 /native/src/widget/helpers.rs | |
parent | f75e0202575ca6e3ebf7d817eecbf51e198506fd (diff) | |
download | iced-7b8b01f560569ae18d9337a31ba94f6c1c2ba0dd.tar.gz iced-7b8b01f560569ae18d9337a31ba94f6c1c2ba0dd.tar.bz2 iced-7b8b01f560569ae18d9337a31ba94f6c1c2ba0dd.zip |
Use `f32` in `Length::Units` and rename it to `Fixed`
Diffstat (limited to 'native/src/widget/helpers.rs')
-rw-r--r-- | native/src/widget/helpers.rs | 14 |
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, |