diff options
author | 2019-08-31 04:08:28 +0200 | |
---|---|---|
committer | 2019-08-31 04:08:28 +0200 | |
commit | 343cafa1ee0b6d29d6e739dfebb13ebe3656a9aa (patch) | |
tree | f71aaf9581a64f1773b072e923a97e07d745c736 | |
parent | 1e3a415379e574983e767141e43ce495a1a8fbe4 (diff) | |
download | iced-343cafa1ee0b6d29d6e739dfebb13ebe3656a9aa.tar.gz iced-343cafa1ee0b6d29d6e739dfebb13ebe3656a9aa.tar.bz2 iced-343cafa1ee0b6d29d6e739dfebb13ebe3656a9aa.zip |
Address documentation feedback
- Fix broken links
- Mention generic `Color` in some widgets
- Clarify meaning of renderer-agnostic in usage/overview example
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | src/lib.rs | 2 | ||||
-rw-r--r-- | src/widget/button.rs | 4 | ||||
-rw-r--r-- | src/widget/checkbox.rs | 9 | ||||
-rw-r--r-- | src/widget/column.rs | 2 | ||||
-rw-r--r-- | src/widget/radio.rs | 9 | ||||
-rw-r--r-- | src/widget/row.rs | 2 | ||||
-rw-r--r-- | src/widget/slider.rs | 4 | ||||
-rw-r--r-- | src/widget/text.rs | 23 |
9 files changed, 27 insertions, 30 deletions
@@ -85,7 +85,7 @@ __view logic__: ```rust use iced::{Button, Column, Text}; -use iced_wgpu::Renderer; // Iced is renderer-agnostic! We need to bring our own! +use iced_wgpu::Renderer; // Iced does not include a renderer! We need to bring our own! impl Counter { pub fn view(&mut self) -> Column<Message, Renderer> { @@ -114,7 +114,7 @@ //! # } //! # } //! use iced::{Button, Column, Text}; -//! use iced_wgpu::Renderer; // Iced is renderer-agnostic! We need to bring our own! +//! use iced_wgpu::Renderer; // Iced does not include a renderer! We need to bring our own! //! //! impl Counter { //! pub fn view(&mut self) -> Column<Message, Renderer> { diff --git a/src/widget/button.rs b/src/widget/button.rs index d77ef8ce..a3ee493c 100644 --- a/src/widget/button.rs +++ b/src/widget/button.rs @@ -242,11 +242,11 @@ pub enum Class { /// The renderer of a [`Button`]. /// -/// Your [`core::Renderer`] will need to implement this trait before being +/// Your [renderer] will need to implement this trait before being /// able to use a [`Button`] in your user interface. /// /// [`Button`]: struct.Button.html -/// [`core::Renderer`]: ../../core/trait.Renderer.html +/// [renderer]: ../../renderer/index.html pub trait Renderer { /// Draws a [`Button`]. /// diff --git a/src/widget/checkbox.rs b/src/widget/checkbox.rs index 75add65c..b8a20d2c 100644 --- a/src/widget/checkbox.rs +++ b/src/widget/checkbox.rs @@ -8,7 +8,7 @@ use crate::{ Widget, }; -/// A box that can be checked. +/// A box that can be checked, with a generic text `Color`. /// /// It implements [`Widget`] when the associated `Renderer` implements the /// [`checkbox::Renderer`] trait. @@ -80,9 +80,8 @@ impl<Color, Message> Checkbox<Color, Message> { } } - /// Sets the [`Color`] of the label of the [`Checkbox`]. + /// Sets the `Color` of the label of the [`Checkbox`]. /// - /// [`Color`]: ../../../../graphics/struct.Color.html /// [`Checkbox`]: struct.Checkbox.html pub fn label_color(mut self, color: Color) -> Self { self.label_color = Some(color); @@ -165,11 +164,11 @@ where /// The renderer of a [`Checkbox`]. /// -/// Your [`core::Renderer`] will need to implement this trait before being +/// Your [renderer] will need to implement this trait before being /// able to use a [`Checkbox`] in your user interface. /// /// [`Checkbox`]: struct.Checkbox.html -/// [`core::Renderer`]: ../../core/trait.Renderer.html +/// [renderer]: ../../renderer/index.html pub trait Renderer { /// Draws a [`Checkbox`]. /// diff --git a/src/widget/column.rs b/src/widget/column.rs index ffef1a5e..83dd2f98 100644 --- a/src/widget/column.rs +++ b/src/widget/column.rs @@ -121,7 +121,7 @@ impl<'a, Message, Renderer> Column<'a, Message, Renderer> { /// Adds an [`Element`] to the [`Column`]. /// - /// [`Element`]: ../core/struct.Element.html + /// [`Element`]: ../struct.Element.html /// [`Column`]: struct.Column.html pub fn push<E>(mut self, child: E) -> Column<'a, Message, Renderer> where diff --git a/src/widget/radio.rs b/src/widget/radio.rs index ead06053..f7ee04e1 100644 --- a/src/widget/radio.rs +++ b/src/widget/radio.rs @@ -8,7 +8,7 @@ use crate::{ use std::hash::Hash; -/// A circular button representing a choice. +/// A circular button representing a choice, with a generic text `Color`. /// /// It implements [`Widget`] when the associated `Renderer` implements the /// [`radio::Renderer`] trait. @@ -92,9 +92,8 @@ impl<Color, Message> Radio<Color, Message> { } } - /// Sets the [`Color`] of the label of the [`Radio`]. + /// Sets the `Color` of the label of the [`Radio`]. /// - /// [`Color`]: ../../../../graphics/struct.Color.html /// [`Radio`]: struct.Radio.html pub fn label_color(mut self, color: Color) -> Self { self.label_color = Some(color); @@ -175,11 +174,11 @@ where /// The renderer of a [`Radio`] button. /// -/// Your [`core::Renderer`] will need to implement this trait before being +/// Your [renderer] will need to implement this trait before being /// able to use a [`Radio`] button in your user interface. /// /// [`Radio`]: struct.Radio.html -/// [`core::Renderer`]: ../../core/trait.Renderer.html +/// [renderer]: ../../renderer/index.html pub trait Renderer { /// Draws a [`Radio`] button. /// diff --git a/src/widget/row.rs b/src/widget/row.rs index c85c85ea..a4d1be2c 100644 --- a/src/widget/row.rs +++ b/src/widget/row.rs @@ -118,7 +118,7 @@ impl<'a, Message, Renderer> Row<'a, Message, Renderer> { /// Adds an [`Element`] to the [`Row`]. /// - /// [`Element`]: ../core/struct.Element.html + /// [`Element`]: ../struct.Element.html /// [`Row`]: struct.Row.html pub fn push<E>(mut self, child: E) -> Row<'a, Message, Renderer> where diff --git a/src/widget/slider.rs b/src/widget/slider.rs index 93d4e7e2..531c2992 100644 --- a/src/widget/slider.rs +++ b/src/widget/slider.rs @@ -201,11 +201,11 @@ impl State { /// The renderer of a [`Slider`]. /// -/// Your [`core::Renderer`] will need to implement this trait before being +/// Your [renderer] will need to implement this trait before being /// able to use a [`Slider`] in your user interface. /// /// [`Slider`]: struct.Slider.html -/// [`core::Renderer`]: ../../core/trait.Renderer.html +/// [renderer]: ../../renderer/index.html pub trait Renderer { /// Draws a [`Slider`]. /// diff --git a/src/widget/text.rs b/src/widget/text.rs index fb6e30b9..2663765d 100644 --- a/src/widget/text.rs +++ b/src/widget/text.rs @@ -5,7 +5,7 @@ use crate::{ use std::hash::Hash; -/// A fragment of text. +/// A fragment of text with a generic `Color`. /// /// It implements [`Widget`] when the associated `Renderer` implements the /// [`text::Renderer`] trait. @@ -60,10 +60,9 @@ impl<Color> Text<Color> { self } - /// Sets the [`Color`] of the [`Text`]. + /// Sets the `Color` of the [`Text`]. /// /// [`Text`]: struct.Text.html - /// [`Color`]: ../../../graphics/struct.Color.html pub fn color(mut self, color: Color) -> Self { self.color = Some(color); self @@ -88,7 +87,7 @@ impl<Color> Text<Color> { /// Sets the [`HorizontalAlignment`] of the [`Text`]. /// /// [`Text`]: struct.Text.html - /// [`HorizontalAlignment`]: ../../../graphics/enum.HorizontalAlignment.html + /// [`HorizontalAlignment`]: enum.HorizontalAlignment.html pub fn horizontal_alignment( mut self, alignment: HorizontalAlignment, @@ -100,7 +99,7 @@ impl<Color> Text<Color> { /// Sets the [`VerticalAlignment`] of the [`Text`]. /// /// [`Text`]: struct.Text.html - /// [`VerticalAlignment`]: ../../../graphics/enum.VerticalAlignment.html + /// [`VerticalAlignment`]: enum.VerticalAlignment.html pub fn vertical_alignment(mut self, alignment: VerticalAlignment) -> Self { self.vertical_alignment = alignment; self @@ -144,11 +143,11 @@ where /// The renderer of a [`Text`] fragment with a generic `Color`. /// -/// Your [`Renderer`] will need to implement this trait before being +/// Your [renderer] will need to implement this trait before being /// able to use [`Text`] in your [`UserInterface`]. /// /// [`Text`]: struct.Text.html -/// [`Renderer`]: ../../trait.Renderer.html +/// [renderer]: ../../renderer/index.html /// [`UserInterface`]: ../../struct.UserInterface.html pub trait Renderer<Color> { /// Creates a [`Node`] with the given [`Style`] for the provided [`Text`] @@ -157,10 +156,10 @@ pub trait Renderer<Color> { /// You should probably use [`Node::with_measure`] to allow [`Text`] to /// adapt to the dimensions of its container. /// - /// [`Node`]: ../../core/struct.Node.html - /// [`Style`]: ../../core/struct.Style.html + /// [`Node`]: ../../struct.Node.html + /// [`Style`]: ../../struct.Style.html /// [`Text`]: struct.Text.html - /// [`Node::with_measure`]: ../../core/struct.Node.html#method.with_measure + /// [`Node::with_measure`]: ../../struct.Node.html#method.with_measure fn node(&self, style: Style, content: &str, size: f32) -> Node; /// Draws a [`Text`] fragment. @@ -174,8 +173,8 @@ pub trait Renderer<Color> { /// * the [`VerticalAlignment`] of the [`Text`] /// /// [`Text`]: struct.Text.html - /// [`HorizontalAlignment`]: ../../../graphics/enum.HorizontalAlignment.html - /// [`VerticalAlignment`]: ../../../graphics/enum.VerticalAlignment.html + /// [`HorizontalAlignment`]: enum.HorizontalAlignment.html + /// [`VerticalAlignment`]: enum.VerticalAlignment.html fn draw( &mut self, bounds: Rectangle<f32>, |