Skip to content

Commit

Permalink
Fix majority of unresolved documentation links
Browse files Browse the repository at this point in the history
  • Loading branch information
matze committed Sep 9, 2023
1 parent 89d9c45 commit 89d9f1d
Show file tree
Hide file tree
Showing 40 changed files with 117 additions and 137 deletions.
2 changes: 1 addition & 1 deletion core/src/angle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl num_traits::FromPrimitive for Radians {
}

impl Radians {
/// Calculates the line in which the [`Angle`] intercepts the `bounds`.
/// Calculates the line in which the angle intercepts the `bounds`.
pub fn to_distance(&self, bounds: &Rectangle) -> (Point, Point) {
let angle = self.0 - FRAC_PI_2;
let r = Vector::new(f32::cos(angle), f32::sin(angle));
Expand Down
2 changes: 1 addition & 1 deletion core/src/gradient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::cmp::Ordering;
///
/// For a gradient which can be used as a fill on a canvas, see [`iced_graphics::Gradient`].
pub enum Gradient {
/// A linear gradient interpolates colors along a direction at a specific [`Angle`].
/// A linear gradient interpolates colors along a direction at a specific angle.
Linear(Linear),
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl<'a, Message> Shell<'a, Message> {
self.messages.push(message);
}

/// Requests a new frame to be drawn at the given [`Instant`].
/// Requests a new frame to be drawn.
pub fn request_redraw(&mut self, request: window::RedrawRequest) {
match self.redraw_request {
None => {
Expand All @@ -48,7 +48,7 @@ impl<'a, Message> Shell<'a, Message> {
}
}

/// Returns the requested [`Instant`] a redraw should happen, if any.
/// Returns the request a redraw should happen, if any.
pub fn redraw_request(&self) -> Option<window::RedrawRequest> {
self.redraw_request
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/window/icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl Icon {
}

#[derive(Debug, thiserror::Error)]
/// An error produced when using [`Icon::from_rgba`] with invalid arguments.
/// An error produced when using [`from_rgba`] with invalid arguments.
pub enum Error {
/// Produced when the length of the `rgba` argument isn't divisible by 4, thus `rgba` can't be
/// safely interpreted as 32bpp RGBA pixels.
Expand Down
5 changes: 3 additions & 2 deletions futures/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use std::marker::PhantomData;
/// A batteries-included runtime of commands and subscriptions.
///
/// If you have an [`Executor`], a [`Runtime`] can be leveraged to run any
/// [`Command`] or [`Subscription`] and get notified of the results!
/// `Command` or [`Subscription`] and get notified of the results!
///
/// [`Command`]: crate::Command
/// [`Subscription`]: crate::Subscription
#[derive(Debug)]
pub struct Runtime<Executor, Sender, Message> {
executor: Executor,
Expand Down Expand Up @@ -75,6 +75,7 @@ where
/// [`Tracker::update`] to learn more about this!
///
/// [`Tracker::update`]: subscription::Tracker::update
/// [`Subscription`]: crate::Subscription
pub fn track(
&mut self,
recipes: impl IntoIterator<
Expand Down
6 changes: 2 additions & 4 deletions futures/src/subscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@ pub type EventStream = BoxStream<(Event, event::Status)>;

/// A request to listen to external events.
///
/// Besides performing async actions on demand with [`Command`], most
/// Besides performing async actions on demand with `Command`, most
/// applications also need to listen to external events passively.
///
/// A [`Subscription`] is normally provided to some runtime, like a [`Command`],
/// A [`Subscription`] is normally provided to some runtime, like a `Command`,
/// and it will generate events as long as the user keeps requesting it.
///
/// For instance, you can use a [`Subscription`] to listen to a WebSocket
/// connection, keyboard presses, mouse events, time ticks, etc.
///
/// [`Command`]: crate::Command
#[must_use = "`Subscription` must be returned to runtime to take effect"]
pub struct Subscription<Message> {
recipes: Vec<Box<dyn Recipe<Output = Message>>>,
Expand Down
3 changes: 3 additions & 0 deletions futures/src/subscription/tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ use std::hash::Hasher as _;
/// If you have an application that continuously returns a [`Subscription`],
/// you can use a [`Tracker`] to keep track of the different recipes and keep
/// its executions alive.
///
/// [`Subscription`]: crate::Subscription
#[derive(Debug, Default)]
pub struct Tracker {
subscriptions: HashMap<u64, Execution>,
Expand Down Expand Up @@ -51,6 +53,7 @@ impl Tracker {
/// the [`Tracker`] changes.
///
/// [`Recipe`]: crate::subscription::Recipe
/// [`Subscription`]: crate::Subscription
pub fn update<Message, Receiver>(
&mut self,
recipes: impl Iterator<Item = Box<dyn Recipe<Output = Message>>>,
Expand Down
4 changes: 2 additions & 2 deletions graphics/src/geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ pub use text::Text;

pub use crate::gradient::{self, Gradient};

/// A renderer capable of drawing some [`Geometry`].
/// A renderer capable of drawing some [`Self::Geometry`].
pub trait Renderer: crate::core::Renderer {
/// The kind of geometry this renderer can draw.
type Geometry;

/// Draws the given layers of [`Geometry`].
/// Draws the given layers of [`Self::Geometry`].
fn draw(&mut self, layers: Vec<Self::Geometry>);
}
4 changes: 2 additions & 2 deletions graphics/src/gradient.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! A gradient that can be used as a [`Fill`] for some geometry.
//! A gradient that can be used as a fill for some geometry.
//!
//! For a gradient that you can use as a background variant for a widget, see [`Gradient`].
//!
Expand Down Expand Up @@ -53,7 +53,7 @@ pub struct Linear {
}

impl Linear {
/// Creates a new [`Builder`].
/// Creates a new [`Linear`] builder.
pub fn new(start: Point, end: Point) -> Self {
Self {
start,
Expand Down
2 changes: 1 addition & 1 deletion graphics/src/mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl Damage for Mesh {
}
}

/// A set of [`Vertex2D`] and indices representing a list of triangles.
/// A set of vertices and indices representing a list of triangles.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Indexed<T> {
/// The vertices of the mesh
Expand Down
4 changes: 1 addition & 3 deletions renderer/src/geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,11 @@ impl Frame {
/// resulting glyphs will not be rotated or scaled properly.
///
/// Additionally, all text will be rendered on top of all the layers of
/// a [`Canvas`]. Therefore, it is currently only meant to be used for
/// a `Canvas`. Therefore, it is currently only meant to be used for
/// overlays, which is the most common use case.
///
/// Support for vectorial text is planned, and should address all these
/// limitations.
///
/// [`Canvas`]: crate::widget::Canvas
pub fn fill_text(&mut self, text: impl Into<Text>) {
delegate!(self, frame, frame.fill_text(text));
}
Expand Down
4 changes: 1 addition & 3 deletions renderer/src/settings.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use crate::core::Font;
use crate::graphics::Antialiasing;

/// The settings of a [`Backend`].
///
/// [`Backend`]: crate::Backend
/// The settings of a Backend.
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Settings {
/// The default [`Font`] to use.
Expand Down
25 changes: 1 addition & 24 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,9 @@
//!
//! ![The native path of the Iced ecosystem](https://github.com/iced-rs/iced/raw/improvement/update-ecosystem-and-roadmap/docs/graphs/native.png)
//!
//! `iced_native` takes [`iced_core`] and builds a native runtime on top of it,
//! featuring:
//!
//! - A custom layout engine, greatly inspired by [`druid`]
//! - Event handling for all the built-in widgets
//! - A renderer-agnostic API
//!
//! To achieve this, it introduces a couple of reusable interfaces:
//!
//! - A [`Widget`] trait, which is used to implement new widgets: from layout
//! requirements to event and drawing logic.
//! - A bunch of `Renderer` traits, meant to keep the crate renderer-agnostic.
//!
//! # Usage
//! The strategy to use this crate depends on your particular use case. If you
//! want to:
//! - Implement a custom shell or integrate it in your own system, check out the
//! [`UserInterface`] type.
//! - Build a new renderer, see the [renderer] module.
//! - Build a custom widget, start at the [`Widget`] trait.
//! `iced_runtime` takes [`iced_core`] and builds a native runtime on top of it.
//!
//! [`iced_core`]: https://github.com/iced-rs/iced/tree/0.10/core
//! [`iced_winit`]: https://github.com/iced-rs/iced/tree/0.10/winit
//! [`druid`]: https://github.com/xi-editor/druid
//! [`raw-window-handle`]: https://github.com/rust-windowing/raw-window-handle
//! [renderer]: crate::renderer
#![doc(
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
)]
Expand Down
4 changes: 3 additions & 1 deletion runtime/src/overlay/nested.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::core::renderer;
use crate::core::widget;
use crate::core::{Clipboard, Event, Layout, Point, Rectangle, Shell, Size};

/// An [`Overlay`] container that displays nested overlays
/// An overlay container that displays nested overlays
#[allow(missing_debug_implementations)]
pub struct Nested<'a, Message, Renderer> {
overlay: overlay::Element<'a, Message, Renderer>,
Expand All @@ -27,6 +27,8 @@ where
}

/// Returns the layout [`Node`] of the [`Nested`] overlay.
///
/// [`Node`]: layout::Node
pub fn layout(
&mut self,
renderer: &Renderer,
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/program/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ where
(uncaptured_events, command)
}

/// Applies [`widget::Operation`]s to the [`State`]
/// Applies [`Operation`]s to the [`State`]
pub fn operate(
&mut self,
renderer: &mut P::Renderer,
Expand Down
4 changes: 2 additions & 2 deletions runtime/src/user_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ where
/// It returns the current [`mouse::Interaction`]. You should update the
/// icon of the mouse cursor accordingly in your system.
///
/// [`Renderer`]: crate::Renderer
/// [`Renderer`]: crate::core::Renderer
///
/// # Example
/// We can finally draw our [counter](index.html#usage) by
Expand Down Expand Up @@ -619,7 +619,7 @@ pub enum State {
/// The [`UserInterface`] is up-to-date and can be reused without
/// rebuilding.
Updated {
/// The [`Instant`] when a redraw should be performed.
/// The [`window::RedrawRequest`] when a redraw should be performed.
redraw_request: Option<window::RedrawRequest>,
},
}
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,11 @@ pub mod system {
pub mod overlay {
//! Display interactive elements on top of other widgets.

/// A generic [`Overlay`].
/// A generic overlay.
///
/// This is an alias of an `iced_native` element with a default `Renderer`.
/// This is an alias of an [`overlay::Element`] with a default `Renderer`.
///
/// [`Overlay`]: iced_native::Overlay
/// [`overlay::Element`]: crate::core::overlay::Element
pub type Element<'a, Message, Renderer = crate::Renderer> =
crate::core::overlay::Element<'a, Message, Renderer>;

Expand Down
2 changes: 1 addition & 1 deletion src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct Settings<Flags> {

/// The default [`Font`] to be used.
///
/// By default, it uses [`Font::SansSerif`].
/// By default, it uses [`Family::SansSerif`](crate::font::Family::SansSerif).
pub default_font: Font,

/// The text size that will be used by default.
Expand Down
2 changes: 1 addition & 1 deletion src/window/icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::path::Path;

/// Creates an icon from an image file.
///
/// This will return an error in case the file is missing at run-time. You may prefer [`Self::from_file_data`] instead.
/// This will return an error in case the file is missing at run-time. You may prefer [`from_file_data`] instead.
#[cfg(feature = "image")]
pub fn from_file<P: AsRef<Path>>(icon_path: P) -> Result<Icon, Error> {
let icon = image::io::Reader::open(icon_path)?.decode()?.to_rgba8();
Expand Down
4 changes: 1 addition & 3 deletions wgpu/src/geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,11 @@ impl Frame {
/// resulting glyphs will not be rotated or scaled properly.
///
/// Additionally, all text will be rendered on top of all the layers of
/// a [`Canvas`]. Therefore, it is currently only meant to be used for
/// a `Canvas`. Therefore, it is currently only meant to be used for
/// overlays, which is the most common use case.
///
/// Support for vectorial text is planned, and should address all these
/// limitations.
///
/// [`Canvas`]: crate::widget::Canvas
pub fn fill_text(&mut self, text: impl Into<Text>) {
let text = text.into();

Expand Down
2 changes: 1 addition & 1 deletion widget/src/canvas/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub use crate::core::event::Status;

/// A [`Canvas`] event.
///
/// [`Canvas`]: crate::widget::Canvas
/// [`Canvas`]: crate::Canvas
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Event {
/// A mouse event.
Expand Down
11 changes: 6 additions & 5 deletions widget/src/canvas/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::graphics::geometry;
/// A [`Program`] can mutate internal state and produce messages for an
/// application.
///
/// [`Canvas`]: crate::widget::Canvas
/// [`Canvas`]: crate::Canvas
pub trait Program<Message, Renderer = crate::Renderer>
where
Renderer: geometry::Renderer,
Expand All @@ -26,7 +26,7 @@ where
///
/// By default, this method does and returns nothing.
///
/// [`Canvas`]: crate::widget::Canvas
/// [`Canvas`]: crate::Canvas
fn update(
&self,
_state: &mut Self::State,
Expand All @@ -42,8 +42,9 @@ where
/// [`Geometry`] can be easily generated with a [`Frame`] or stored in a
/// [`Cache`].
///
/// [`Frame`]: crate::widget::canvas::Frame
/// [`Cache`]: crate::widget::canvas::Cache
/// [`Geometry`]: crate::canvas::Geometry
/// [`Frame`]: crate::canvas::Frame
/// [`Cache`]: crate::canvas::Cache
fn draw(
&self,
state: &Self::State,
Expand All @@ -58,7 +59,7 @@ where
/// The interaction returned will be in effect even if the cursor position
/// is out of bounds of the program's [`Canvas`].
///
/// [`Canvas`]: crate::widget::Canvas
/// [`Canvas`]: crate::Canvas
fn mouse_interaction(
&self,
_state: &Self::State,
Expand Down
6 changes: 3 additions & 3 deletions widget/src/checkbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ where
self
}

/// Sets the text [`LineHeight`] of the [`Checkbox`].
/// Sets the text [`text::LineHeight`] of the [`Checkbox`].
pub fn text_line_height(
mut self,
line_height: impl Into<text::LineHeight>,
Expand All @@ -137,9 +137,9 @@ where
self
}

/// Sets the [`Font`] of the text of the [`Checkbox`].
/// Sets the [`Renderer::Font`] of the text of the [`Checkbox`].
///
/// [`Font`]: crate::text::Renderer::Font
/// [`Renderer::Font`]: crate::core::text::Renderer
pub fn font(mut self, font: impl Into<Renderer::Font>) -> Self {
self.font = Some(font.into());
self
Expand Down
8 changes: 5 additions & 3 deletions widget/src/combo_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::time::Instant;
///
/// This widget is composed by a [`TextInput`] that can be filled with the text
/// to search for corresponding values from the list of options that are displayed
/// as a [`Menu`].
/// as a Menu.
#[allow(missing_debug_implementations)]
pub struct ComboBox<'a, T, Message, Renderer = crate::Renderer>
where
Expand Down Expand Up @@ -131,14 +131,16 @@ where
self
}

/// Sets the [`Font`] of the [`ComboBox`].
/// Sets the [`Renderer::Font`] of the [`ComboBox`].
///
/// [`Renderer::Font`]: text::Renderer
pub fn font(mut self, font: Renderer::Font) -> Self {
self.text_input = self.text_input.font(font);
self.font = Some(font);
self
}

/// Sets the [`Icon`] of the [`ComboBox`].
/// Sets the [`text_input::Icon`] of the [`ComboBox`].
pub fn icon(mut self, icon: text_input::Icon<Renderer::Font>) -> Self {
self.text_input = self.text_input.icon(icon);
self
Expand Down
Loading

0 comments on commit 89d9f1d

Please sign in to comment.