Address documentation feedback

- Fix broken links
  - Mention generic `Color` in some widgets
  - Clarify meaning of renderer-agnostic in usage/overview example
This commit is contained in:
Héctor Ramón Jiménez 2019-08-31 04:08:28 +02:00
parent 1e3a415379
commit 343cafa1ee
9 changed files with 27 additions and 30 deletions

View File

@ -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> {

View File

@ -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> {

View File

@ -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`].
///

View File

@ -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`].
///

View File

@ -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

View File

@ -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.
///

View File

@ -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

View File

@ -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`].
///

View File

@ -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>,