From 68e9eb0a9b45b86713ce5d0e9c2273a60f2cc11c Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 30 Apr 2022 14:20:52 +0200 Subject: Fix broken intra-doc links in documentation --- pure/src/helpers.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'pure/src/helpers.rs') diff --git a/pure/src/helpers.rs b/pure/src/helpers.rs index 2ddab3ae..d6744262 100644 --- a/pure/src/helpers.rs +++ b/pure/src/helpers.rs @@ -142,11 +142,15 @@ pub fn vertical_space(height: Length) -> widget::Space { } /// Creates a horizontal [`Rule`] with the given height. +/// +/// [`Rule`]: widget::Rule pub fn horizontal_rule<'a>(height: u16) -> widget::Rule<'a> { widget::Rule::horizontal(height) } /// Creates a vertical [`Rule`] with the given width. +/// +/// [`Rule`]: widget::Rule pub fn vertical_rule<'a>(width: u16) -> widget::Rule<'a> { widget::Rule::horizontal(width) } @@ -154,8 +158,10 @@ pub fn vertical_rule<'a>(width: u16) -> widget::Rule<'a> { /// Creates a new [`ProgressBar`]. /// /// It expects: -/// * an inclusive range of possible values -/// * the current value of the [`ProgressBar`] +/// * an inclusive range of possible values, and +/// * the current value of the [`ProgressBar`]. +/// +/// [`ProgressBar`]: widget::ProgressBar pub fn progress_bar<'a>( range: RangeInclusive, value: f32, -- cgit From e7d595c7de3854e165fd68f05ab2292cae69dbc4 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 2 May 2022 20:16:00 +0200 Subject: Write documentation for `iced_pure` --- pure/src/helpers.rs | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'pure/src/helpers.rs') diff --git a/pure/src/helpers.rs b/pure/src/helpers.rs index d6744262..2c4a37be 100644 --- a/pure/src/helpers.rs +++ b/pure/src/helpers.rs @@ -1,3 +1,4 @@ +//! Helper functions to create pure widgets. use crate::widget; use crate::Element; @@ -5,6 +6,9 @@ use iced_native::Length; use std::borrow::Cow; use std::ops::RangeInclusive; +/// Creates a new [`Container`] with the provided content. +/// +/// [`Container`]: widget::Container pub fn container<'a, Message, Renderer>( content: impl Into>, ) -> widget::Container<'a, Message, Renderer> @@ -14,15 +18,24 @@ where widget::Container::new(content) } +/// Creates a new [`Column`]. +/// +/// [`Column`]: widget::Column pub fn column<'a, Message, Renderer>() -> widget::Column<'a, Message, Renderer> { widget::Column::new() } +/// Creates a new [`Row`]. +/// +/// [`Row`]: widget::Row pub fn row<'a, Message, Renderer>() -> widget::Row<'a, Message, Renderer> { widget::Row::new() } +/// Creates a new [`Scrollable`] with the provided content. +/// +/// [`Scrollable`]: widget::Scrollable pub fn scrollable<'a, Message, Renderer>( content: impl Into>, ) -> widget::Scrollable<'a, Message, Renderer> @@ -32,12 +45,19 @@ where widget::Scrollable::new(content) } +/// Creates a new [`Button`] with the provided content. +/// +/// [`Button`]: widget::Button pub fn button<'a, Message, Renderer>( content: impl Into>, ) -> widget::Button<'a, Message, Renderer> { widget::Button::new(content) } +/// Creates a new [`Tooltip`] with the provided content, tooltip text, and [`tooltip::Position`]. +/// +/// [`Tooltip`]: widget::Tooltip +/// [`tooltip::Position`]: widget::tooltip::Position pub fn tooltip<'a, Message, Renderer>( content: impl Into>, tooltip: impl ToString, @@ -49,6 +69,9 @@ where widget::Tooltip::new(content, tooltip, position) } +/// Creates a new [`Text`] widget with the provided content. +/// +/// [`Text`]: widget::Text pub fn text(text: impl Into) -> widget::Text where Renderer: iced_native::text::Renderer, @@ -56,6 +79,9 @@ where widget::Text::new(text) } +/// Creates a new [`Checkbox`]. +/// +/// [`Checkbox`]: widget::Checkbox pub fn checkbox<'a, Message, Renderer>( label: impl Into, is_checked: bool, @@ -67,6 +93,9 @@ where widget::Checkbox::new(is_checked, label, f) } +/// Creates a new [`Radio`]. +/// +/// [`Radio`]: widget::Radio pub fn radio<'a, Message, Renderer, V>( label: impl Into, value: V, @@ -81,6 +110,9 @@ where widget::Radio::new(value, label, selected, on_click) } +/// Creates a new [`Toggler`]. +/// +/// [`Toggler`]: widget::Toggler pub fn toggler<'a, Message, Renderer>( label: impl Into>, is_checked: bool, @@ -92,6 +124,9 @@ where widget::Toggler::new(is_checked, label, f) } +/// Creates a new [`TextInput`]. +/// +/// [`TextInput`]: widget::TextInput pub fn text_input<'a, Message, Renderer>( placeholder: &str, value: &str, @@ -104,6 +139,9 @@ where widget::TextInput::new(placeholder, value, on_change) } +/// Creates a new [`Slider`]. +/// +/// [`Slider`]: widget::Slider pub fn slider<'a, Message, T>( range: std::ops::RangeInclusive, value: T, @@ -116,6 +154,9 @@ where widget::Slider::new(range, value, on_change) } +/// Creates a new [`PickList`]. +/// +/// [`PickList`]: widget::PickList pub fn pick_list<'a, Message, Renderer, T>( options: impl Into>, selected: Option, @@ -129,14 +170,23 @@ where widget::PickList::new(options, selected, on_selected) } +/// Creates a new [`Image`]. +/// +/// [`Image`]: widget::Image pub fn image(handle: impl Into) -> widget::Image { widget::Image::new(handle.into()) } +/// Creates a new horizontal [`Space`] with the given [`Length`]. +/// +/// [`Space`]: widget::Space pub fn horizontal_space(width: 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 { widget::Space::with_height(height) } -- cgit