Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix majority of unresolved documentation links #2077

Merged
merged 3 commits into from
Sep 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/document.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name: Document
on:
push:
branches:
- master
on: [push, pull_request]
jobs:
all:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -31,6 +28,7 @@ jobs:
- name: Write CNAME file
run: echo 'docs.iced.rs' > ./target/doc/CNAME
- name: Publish documentation
if: github.ref == 'refs/heads/master'
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.DOCS_DEPLOY_KEY }}
Expand Down
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
4 changes: 1 addition & 3 deletions core/src/gradient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ use std::cmp::Ordering;
#[derive(Debug, Clone, Copy, PartialEq)]
/// A fill which transitions colors progressively along a direction, either linearly, radially (TBD),
/// or conically (TBD).
///
/// 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
5 changes: 3 additions & 2 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#![doc(
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
)]
#![forbid(unsafe_code, rust_2018_idioms)]
#![deny(
missing_debug_implementations,
missing_docs,
Expand All @@ -17,9 +18,9 @@
clippy::from_over_into,
clippy::needless_borrow,
clippy::new_without_default,
clippy::useless_conversion
clippy::useless_conversion,
rustdoc::broken_intra_doc_links
)]
#![forbid(unsafe_code, rust_2018_idioms)]
#![allow(clippy::inherent_to_string, clippy::type_complexity)]
pub mod alignment;
pub mod clipboard;
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/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#![doc(
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
)]
#![forbid(unsafe_code, rust_2018_idioms)]
#![deny(
missing_debug_implementations,
missing_docs,
Expand All @@ -12,9 +13,9 @@
clippy::from_over_into,
clippy::needless_borrow,
clippy::new_without_default,
clippy::useless_conversion
clippy::useless_conversion,
rustdoc::broken_intra_doc_links
)]
#![forbid(unsafe_code, rust_2018_idioms)]
#![allow(clippy::inherent_to_string, clippy::type_complexity)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
pub use futures;
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
2 changes: 1 addition & 1 deletion graphics/src/compositor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub trait Compositor: Sized {
/// Screenshots the current [`Renderer`] primitives to an offscreen texture, and returns the bytes of
/// the texture ordered as `RGBA` in the sRGB color space.
///
/// [`Renderer`]: Self::Renderer;
/// [`Renderer`]: Self::Renderer
fn screenshot<T: AsRef<str>>(
&mut self,
renderer: &mut Self::Renderer,
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: 3 additions & 1 deletion graphics/src/geometry/fill.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//! Fill [crate::widget::canvas::Geometry] with a certain style.
//! Fill [`Geometry`] with a certain style.
//!
//! [`Geometry`]: super::Renderer::Geometry
pub use crate::geometry::Style;

use crate::core::Color;
Expand Down
4 changes: 3 additions & 1 deletion graphics/src/geometry/stroke.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//! Create lines from a [crate::widget::canvas::Path] and assigns them various attributes/styles.
//! Create lines from a [`Path`] and assigns them various attributes/styles.
//!
//! [`Path`]: super::Path
pub use crate::geometry::Style;

use iced_core::Color;
Expand Down
11 changes: 3 additions & 8 deletions graphics/src/gradient.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
//! 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`].
//!
//! [`Gradient`]: crate::core::Gradient;
use crate::color;
use crate::core::gradient::ColorStop;
use crate::core::{self, Color, Point, Rectangle};
Expand Down Expand Up @@ -36,10 +34,7 @@ impl Gradient {
}
}

/// A linear gradient that can be used in the style of [`Fill`] or [`Stroke`].
///
/// [`Fill`]: crate::geometry::Fill;
/// [`Stroke`]: crate::geometry::Stroke;
/// A linear gradient.
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Linear {
/// The absolute starting position of the gradient.
Expand All @@ -53,7 +48,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
5 changes: 3 additions & 2 deletions graphics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#![doc(
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
)]
#![forbid(rust_2018_idioms)]
#![deny(
missing_debug_implementations,
missing_docs,
Expand All @@ -16,9 +17,9 @@
clippy::from_over_into,
clippy::needless_borrow,
clippy::new_without_default,
clippy::useless_conversion
clippy::useless_conversion,
rustdoc::broken_intra_doc_links
)]
#![forbid(rust_2018_idioms)]
#![allow(clippy::inherent_to_string, clippy::type_complexity)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
mod antialiasing;
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
13 changes: 13 additions & 0 deletions renderer/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
#![forbid(rust_2018_idioms)]
#![deny(
unsafe_code,
unused_results,
clippy::extra_unused_lifetimes,
clippy::from_over_into,
clippy::needless_borrow,
clippy::new_without_default,
clippy::useless_conversion,
rustdoc::broken_intra_doc_links
)]
#![allow(clippy::inherent_to_string, clippy::type_complexity)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
pub mod compositor;

#[cfg(feature = "geometry")]
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
30 changes: 4 additions & 26 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,13 @@
//!
//! ![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"
)]
#![forbid(unsafe_code, rust_2018_idioms)]
#![deny(
missing_debug_implementations,
missing_docs,
Expand All @@ -39,9 +17,9 @@
clippy::from_over_into,
clippy::needless_borrow,
clippy::new_without_default,
clippy::useless_conversion
clippy::useless_conversion,
rustdoc::broken_intra_doc_links
)]
#![forbid(unsafe_code, rust_2018_idioms)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
pub mod clipboard;
pub mod command;
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>,
},
}
Loading
Loading