Merge pull request #2077 from matze/fix-doc-links

Fix majority of unresolved documentation links
This commit is contained in:
Héctor Ramón 2023-09-09 21:16:55 +02:00 committed by GitHub
commit e3aa8f71e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
58 changed files with 193 additions and 181 deletions

View file

@ -1,8 +1,5 @@
name: Document name: Document
on: on: [push, pull_request]
push:
branches:
- master
jobs: jobs:
all: all:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
@ -31,6 +28,7 @@ jobs:
- name: Write CNAME file - name: Write CNAME file
run: echo 'docs.iced.rs' > ./target/doc/CNAME run: echo 'docs.iced.rs' > ./target/doc/CNAME
- name: Publish documentation - name: Publish documentation
if: github.ref == 'refs/heads/master'
uses: peaceiris/actions-gh-pages@v3 uses: peaceiris/actions-gh-pages@v3
with: with:
deploy_key: ${{ secrets.DOCS_DEPLOY_KEY }} deploy_key: ${{ secrets.DOCS_DEPLOY_KEY }}

View file

@ -55,7 +55,7 @@ impl num_traits::FromPrimitive for Radians {
} }
impl 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) { pub fn to_distance(&self, bounds: &Rectangle) -> (Point, Point) {
let angle = self.0 - FRAC_PI_2; let angle = self.0 - FRAC_PI_2;
let r = Vector::new(f32::cos(angle), f32::sin(angle)); let r = Vector::new(f32::cos(angle), f32::sin(angle));

View file

@ -6,10 +6,8 @@ use std::cmp::Ordering;
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq)]
/// A fill which transitions colors progressively along a direction, either linearly, radially (TBD), /// A fill which transitions colors progressively along a direction, either linearly, radially (TBD),
/// or conically (TBD). /// or conically (TBD).
///
/// For a gradient which can be used as a fill on a canvas, see [`iced_graphics::Gradient`].
pub enum 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), Linear(Linear),
} }

View file

@ -9,6 +9,7 @@
#![doc( #![doc(
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg" html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
)] )]
#![forbid(unsafe_code, rust_2018_idioms)]
#![deny( #![deny(
missing_debug_implementations, missing_debug_implementations,
missing_docs, missing_docs,
@ -17,9 +18,9 @@
clippy::from_over_into, clippy::from_over_into,
clippy::needless_borrow, clippy::needless_borrow,
clippy::new_without_default, 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)] #![allow(clippy::inherent_to_string, clippy::type_complexity)]
pub mod alignment; pub mod alignment;
pub mod clipboard; pub mod clipboard;

View file

@ -35,7 +35,7 @@ impl<'a, Message> Shell<'a, Message> {
self.messages.push(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) { pub fn request_redraw(&mut self, request: window::RedrawRequest) {
match self.redraw_request { match self.redraw_request {
None => { None => {
@ -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> { pub fn redraw_request(&self) -> Option<window::RedrawRequest> {
self.redraw_request self.redraw_request
} }

View file

@ -49,7 +49,7 @@ impl Icon {
} }
#[derive(Debug, thiserror::Error)] #[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 { pub enum Error {
/// Produced when the length of the `rgba` argument isn't divisible by 4, thus `rgba` can't be /// Produced when the length of the `rgba` argument isn't divisible by 4, thus `rgba` can't be
/// safely interpreted as 32bpp RGBA pixels. /// safely interpreted as 32bpp RGBA pixels.

View file

@ -4,6 +4,7 @@
#![doc( #![doc(
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg" html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
)] )]
#![forbid(unsafe_code, rust_2018_idioms)]
#![deny( #![deny(
missing_debug_implementations, missing_debug_implementations,
missing_docs, missing_docs,
@ -12,9 +13,9 @@
clippy::from_over_into, clippy::from_over_into,
clippy::needless_borrow, clippy::needless_borrow,
clippy::new_without_default, 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)] #![allow(clippy::inherent_to_string, clippy::type_complexity)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(docsrs, feature(doc_auto_cfg))]
pub use futures; pub use futures;

View file

@ -9,9 +9,9 @@ use std::marker::PhantomData;
/// A batteries-included runtime of commands and subscriptions. /// A batteries-included runtime of commands and subscriptions.
/// ///
/// If you have an [`Executor`], a [`Runtime`] can be leveraged to run any /// 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)] #[derive(Debug)]
pub struct Runtime<Executor, Sender, Message> { pub struct Runtime<Executor, Sender, Message> {
executor: Executor, executor: Executor,
@ -75,6 +75,7 @@ where
/// [`Tracker::update`] to learn more about this! /// [`Tracker::update`] to learn more about this!
/// ///
/// [`Tracker::update`]: subscription::Tracker::update /// [`Tracker::update`]: subscription::Tracker::update
/// [`Subscription`]: crate::Subscription
pub fn track( pub fn track(
&mut self, &mut self,
recipes: impl IntoIterator< recipes: impl IntoIterator<

View file

@ -19,16 +19,14 @@ pub type EventStream = BoxStream<(Event, event::Status)>;
/// A request to listen to external events. /// 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. /// 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. /// 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 /// For instance, you can use a [`Subscription`] to listen to a WebSocket
/// connection, keyboard presses, mouse events, time ticks, etc. /// connection, keyboard presses, mouse events, time ticks, etc.
///
/// [`Command`]: crate::Command
#[must_use = "`Subscription` must be returned to runtime to take effect"] #[must_use = "`Subscription` must be returned to runtime to take effect"]
pub struct Subscription<Message> { pub struct Subscription<Message> {
recipes: Vec<Box<dyn Recipe<Output = Message>>>, recipes: Vec<Box<dyn Recipe<Output = Message>>>,

View file

@ -14,6 +14,8 @@ use std::hash::Hasher as _;
/// If you have an application that continuously returns a [`Subscription`], /// If you have an application that continuously returns a [`Subscription`],
/// you can use a [`Tracker`] to keep track of the different recipes and keep /// you can use a [`Tracker`] to keep track of the different recipes and keep
/// its executions alive. /// its executions alive.
///
/// [`Subscription`]: crate::Subscription
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub struct Tracker { pub struct Tracker {
subscriptions: HashMap<u64, Execution>, subscriptions: HashMap<u64, Execution>,
@ -51,6 +53,7 @@ impl Tracker {
/// the [`Tracker`] changes. /// the [`Tracker`] changes.
/// ///
/// [`Recipe`]: crate::subscription::Recipe /// [`Recipe`]: crate::subscription::Recipe
/// [`Subscription`]: crate::Subscription
pub fn update<Message, Receiver>( pub fn update<Message, Receiver>(
&mut self, &mut self,
recipes: impl Iterator<Item = Box<dyn Recipe<Output = Message>>>, recipes: impl Iterator<Item = Box<dyn Recipe<Output = Message>>>,

View file

@ -63,7 +63,7 @@ pub trait Compositor: Sized {
/// Screenshots the current [`Renderer`] primitives to an offscreen texture, and returns the bytes of /// Screenshots the current [`Renderer`] primitives to an offscreen texture, and returns the bytes of
/// the texture ordered as `RGBA` in the sRGB color space. /// the texture ordered as `RGBA` in the sRGB color space.
/// ///
/// [`Renderer`]: Self::Renderer; /// [`Renderer`]: Self::Renderer
fn screenshot<T: AsRef<str>>( fn screenshot<T: AsRef<str>>(
&mut self, &mut self,
renderer: &mut Self::Renderer, renderer: &mut Self::Renderer,

View file

@ -14,11 +14,11 @@ pub use text::Text;
pub use crate::gradient::{self, Gradient}; 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 { pub trait Renderer: crate::core::Renderer {
/// The kind of geometry this renderer can draw. /// The kind of geometry this renderer can draw.
type Geometry; type Geometry;
/// Draws the given layers of [`Geometry`]. /// Draws the given layers of [`Self::Geometry`].
fn draw(&mut self, layers: Vec<Self::Geometry>); fn draw(&mut self, layers: Vec<Self::Geometry>);
} }

View file

@ -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; pub use crate::geometry::Style;
use crate::core::Color; use crate::core::Color;

View file

@ -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; pub use crate::geometry::Style;
use iced_core::Color; use iced_core::Color;

View file

@ -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`]. //! 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::color;
use crate::core::gradient::ColorStop; use crate::core::gradient::ColorStop;
use crate::core::{self, Color, Point, Rectangle}; use crate::core::{self, Color, Point, Rectangle};
@ -36,10 +34,7 @@ impl Gradient {
} }
} }
/// A linear gradient that can be used in the style of [`Fill`] or [`Stroke`]. /// A linear gradient.
///
/// [`Fill`]: crate::geometry::Fill;
/// [`Stroke`]: crate::geometry::Stroke;
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq)]
pub struct Linear { pub struct Linear {
/// The absolute starting position of the gradient. /// The absolute starting position of the gradient.
@ -53,7 +48,7 @@ pub struct Linear {
} }
impl Linear { impl Linear {
/// Creates a new [`Builder`]. /// Creates a new [`Linear`] builder.
pub fn new(start: Point, end: Point) -> Self { pub fn new(start: Point, end: Point) -> Self {
Self { Self {
start, start,

View file

@ -7,6 +7,7 @@
#![doc( #![doc(
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg" html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
)] )]
#![forbid(rust_2018_idioms)]
#![deny( #![deny(
missing_debug_implementations, missing_debug_implementations,
missing_docs, missing_docs,
@ -16,9 +17,9 @@
clippy::from_over_into, clippy::from_over_into,
clippy::needless_borrow, clippy::needless_borrow,
clippy::new_without_default, 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)] #![allow(clippy::inherent_to_string, clippy::type_complexity)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(docsrs, feature(doc_auto_cfg))]
mod antialiasing; mod antialiasing;

View file

@ -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)] #[derive(Clone, Debug, PartialEq, Eq)]
pub struct Indexed<T> { pub struct Indexed<T> {
/// The vertices of the mesh /// The vertices of the mesh

View file

@ -96,13 +96,11 @@ impl Frame {
/// resulting glyphs will not be rotated or scaled properly. /// resulting glyphs will not be rotated or scaled properly.
/// ///
/// Additionally, all text will be rendered on top of all the layers of /// 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. /// overlays, which is the most common use case.
/// ///
/// Support for vectorial text is planned, and should address all these /// Support for vectorial text is planned, and should address all these
/// limitations. /// limitations.
///
/// [`Canvas`]: crate::widget::Canvas
pub fn fill_text(&mut self, text: impl Into<Text>) { pub fn fill_text(&mut self, text: impl Into<Text>) {
delegate!(self, frame, frame.fill_text(text)); delegate!(self, frame, frame.fill_text(text));
} }

View file

@ -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; pub mod compositor;
#[cfg(feature = "geometry")] #[cfg(feature = "geometry")]

View file

@ -1,9 +1,7 @@
use crate::core::Font; use crate::core::Font;
use crate::graphics::Antialiasing; use crate::graphics::Antialiasing;
/// The settings of a [`Backend`]. /// The settings of a Backend.
///
/// [`Backend`]: crate::Backend
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq)]
pub struct Settings { pub struct Settings {
/// The default [`Font`] to use. /// The default [`Font`] to use.

View file

@ -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) //! ![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, //! `iced_runtime` 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_core`]: https://github.com/iced-rs/iced/tree/0.10/core //! [`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( #![doc(
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg" html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
)] )]
#![forbid(unsafe_code, rust_2018_idioms)]
#![deny( #![deny(
missing_debug_implementations, missing_debug_implementations,
missing_docs, missing_docs,
@ -39,9 +17,9 @@
clippy::from_over_into, clippy::from_over_into,
clippy::needless_borrow, clippy::needless_borrow,
clippy::new_without_default, 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))] #![cfg_attr(docsrs, feature(doc_auto_cfg))]
pub mod clipboard; pub mod clipboard;
pub mod command; pub mod command;

View file

@ -6,7 +6,7 @@ use crate::core::renderer;
use crate::core::widget; use crate::core::widget;
use crate::core::{Clipboard, Event, Layout, Point, Rectangle, Shell, Size}; 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)] #[allow(missing_debug_implementations)]
pub struct Nested<'a, Message, Renderer> { pub struct Nested<'a, Message, Renderer> {
overlay: overlay::Element<'a, Message, Renderer>, overlay: overlay::Element<'a, Message, Renderer>,
@ -27,6 +27,8 @@ where
} }
/// Returns the layout [`Node`] of the [`Nested`] overlay. /// Returns the layout [`Node`] of the [`Nested`] overlay.
///
/// [`Node`]: layout::Node
pub fn layout( pub fn layout(
&mut self, &mut self,
renderer: &Renderer, renderer: &Renderer,

View file

@ -175,7 +175,7 @@ where
(uncaptured_events, command) (uncaptured_events, command)
} }
/// Applies [`widget::Operation`]s to the [`State`] /// Applies [`Operation`]s to the [`State`]
pub fn operate( pub fn operate(
&mut self, &mut self,
renderer: &mut P::Renderer, renderer: &mut P::Renderer,

View file

@ -356,7 +356,7 @@ where
/// It returns the current [`mouse::Interaction`]. You should update the /// It returns the current [`mouse::Interaction`]. You should update the
/// icon of the mouse cursor accordingly in your system. /// icon of the mouse cursor accordingly in your system.
/// ///
/// [`Renderer`]: crate::Renderer /// [`Renderer`]: crate::core::Renderer
/// ///
/// # Example /// # Example
/// We can finally draw our [counter](index.html#usage) by /// We can finally draw our [counter](index.html#usage) by
@ -619,7 +619,7 @@ pub enum State {
/// The [`UserInterface`] is up-to-date and can be reused without /// The [`UserInterface`] is up-to-date and can be reused without
/// rebuilding. /// rebuilding.
Updated { Updated {
/// The [`Instant`] when a redraw should be performed. /// The [`window::RedrawRequest`] when a redraw should be performed.
redraw_request: Option<window::RedrawRequest>, redraw_request: Option<window::RedrawRequest>,
}, },
} }

View file

@ -151,6 +151,7 @@
#![doc( #![doc(
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg" html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
)] )]
#![forbid(rust_2018_idioms, unsafe_code)]
#![deny( #![deny(
missing_debug_implementations, missing_debug_implementations,
missing_docs, missing_docs,
@ -159,9 +160,9 @@
clippy::from_over_into, clippy::from_over_into,
clippy::needless_borrow, clippy::needless_borrow,
clippy::new_without_default, clippy::new_without_default,
clippy::useless_conversion clippy::useless_conversion,
rustdoc::broken_intra_doc_links
)] )]
#![forbid(rust_2018_idioms, unsafe_code)]
#![allow(clippy::inherent_to_string, clippy::type_complexity)] #![allow(clippy::inherent_to_string, clippy::type_complexity)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(docsrs, feature(doc_auto_cfg))]
use iced_widget::graphics; use iced_widget::graphics;
@ -258,11 +259,11 @@ pub mod system {
pub mod overlay { pub mod overlay {
//! Display interactive elements on top of other widgets. //! 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> = pub type Element<'a, Message, Renderer = crate::Renderer> =
crate::core::overlay::Element<'a, Message, Renderer>; crate::core::overlay::Element<'a, Message, Renderer>;

View file

@ -23,7 +23,7 @@ pub struct Settings<Flags> {
/// The default [`Font`] to be used. /// 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, pub default_font: Font,
/// The text size that will be used by default. /// The text size that will be used by default.

View file

@ -10,7 +10,7 @@ use std::path::Path;
/// Creates an icon from an image file. /// 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")] #[cfg(feature = "image")]
pub fn from_file<P: AsRef<Path>>(icon_path: P) -> Result<Icon, Error> { pub fn from_file<P: AsRef<Path>>(icon_path: P) -> Result<Icon, Error> {
let icon = image::io::Reader::open(icon_path)?.decode()?.to_rgba8(); let icon = image::io::Reader::open(icon_path)?.decode()?.to_rgba8();

View file

@ -7,16 +7,18 @@
#![doc( #![doc(
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg" html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
)] )]
#![forbid(unsafe_code, rust_2018_idioms)]
#![deny( #![deny(
unused_results, unused_results,
clippy::extra_unused_lifetimes, clippy::extra_unused_lifetimes,
clippy::from_over_into, clippy::from_over_into,
clippy::needless_borrow, clippy::needless_borrow,
clippy::new_without_default, clippy::new_without_default,
clippy::useless_conversion clippy::useless_conversion,
missing_docs,
unused_results,
rustdoc::broken_intra_doc_links
)] )]
#![deny(missing_docs, unused_results)]
#![forbid(unsafe_code, rust_2018_idioms)]
#![allow(clippy::inherent_to_string, clippy::type_complexity)] #![allow(clippy::inherent_to_string, clippy::type_complexity)]
pub use iced_core as core; pub use iced_core as core;

View file

@ -303,7 +303,7 @@ pub fn into_fill_rule(rule: fill::Rule) -> tiny_skia::FillRule {
} }
} }
pub fn into_stroke(stroke: &Stroke) -> tiny_skia::Stroke { pub fn into_stroke(stroke: &Stroke<'_>) -> tiny_skia::Stroke {
tiny_skia::Stroke { tiny_skia::Stroke {
width: stroke.width, width: stroke.width,
line_cap: match stroke.line_cap { line_cap: match stroke.line_cap {

View file

@ -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 window; pub mod window;
mod backend; mod backend;

View file

@ -85,14 +85,14 @@ impl Cache {
); );
} }
entry.insert(Some(Entry { let _ = entry.insert(Some(Entry {
width: image.width(), width: image.width(),
height: image.height(), height: image.height(),
pixels: buffer, pixels: buffer,
})); }));
} }
self.hits.insert(id); let _ = self.hits.insert(id);
self.entries.get(&id).unwrap().as_ref().map(|entry| { self.entries.get(&id).unwrap().as_ref().map(|entry| {
tiny_skia::PixmapRef::from_bytes( tiny_skia::PixmapRef::from_bytes(
bytemuck::cast_slice(&entry.pixels), bytemuck::cast_slice(&entry.pixels),

View file

@ -32,7 +32,7 @@ impl Pipeline {
} }
pub fn load_font(&mut self, bytes: Cow<'static, [u8]>) { pub fn load_font(&mut self, bytes: Cow<'static, [u8]>) {
self.font_system.get_mut().db_mut().load_font_source( let _ = self.font_system.get_mut().db_mut().load_font_source(
cosmic_text::fontdb::Source::Binary(Arc::new(bytes.into_owned())), cosmic_text::fontdb::Source::Binary(Arc::new(bytes.into_owned())),
); );
@ -335,10 +335,10 @@ impl GlyphCache {
} }
} }
entry.insert((buffer, image.placement)); let _ = entry.insert((buffer, image.placement));
} }
self.recently_used.insert(key); let _ = self.recently_used.insert(key);
self.entries.get(&key).map(|(buffer, placement)| { self.entries.get(&key).map(|(buffer, placement)| {
(bytemuck::cast_slice(buffer.as_slice()), *placement) (bytemuck::cast_slice(buffer.as_slice()), *placement)

View file

@ -92,10 +92,10 @@ impl Cache {
} }
}; };
entry.insert(svg); let _ = entry.insert(svg);
} }
self.tree_hits.insert(id); let _ = self.tree_hits.insert(id);
self.trees.get(&id).unwrap().as_ref() self.trees.get(&id).unwrap().as_ref()
} }
@ -178,10 +178,10 @@ impl Cache {
} }
} }
self.rasters.insert(key, image); let _ = self.rasters.insert(key, image);
} }
self.raster_hits.insert(key); let _ = self.raster_hits.insert(key);
self.rasters.get(&key).map(tiny_skia::Pixmap::as_ref) self.rasters.get(&key).map(tiny_skia::Pixmap::as_ref)
} }

View file

@ -39,6 +39,7 @@ impl<Theme> crate::graphics::Compositor for Compositor<Theme> {
width: u32, width: u32,
height: u32, height: u32,
) -> Surface { ) -> Surface {
#[allow(unsafe_code)]
let window = let window =
unsafe { softbuffer::GraphicsContext::new(window, window) } unsafe { softbuffer::GraphicsContext::new(window, window) }
.expect("Create softbuffer for window"); .expect("Create softbuffer for window");

View file

@ -310,13 +310,11 @@ impl Frame {
/// resulting glyphs will not be rotated or scaled properly. /// resulting glyphs will not be rotated or scaled properly.
/// ///
/// Additionally, all text will be rendered on top of all the layers of /// 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. /// overlays, which is the most common use case.
/// ///
/// Support for vectorial text is planned, and should address all these /// Support for vectorial text is planned, and should address all these
/// limitations. /// limitations.
///
/// [`Canvas`]: crate::widget::Canvas
pub fn fill_text(&mut self, text: impl Into<Text>) { pub fn fill_text(&mut self, text: impl Into<Text>) {
let text = text.into(); let text = text.into();

View file

@ -20,6 +20,7 @@
#![doc( #![doc(
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg" html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
)] )]
#![forbid(rust_2018_idioms)]
#![deny( #![deny(
missing_debug_implementations, missing_debug_implementations,
missing_docs, missing_docs,
@ -29,9 +30,9 @@
clippy::from_over_into, clippy::from_over_into,
clippy::needless_borrow, clippy::needless_borrow,
clippy::new_without_default, 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)] #![allow(clippy::inherent_to_string, clippy::type_complexity)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(docsrs, feature(doc_auto_cfg))]
pub mod layer; pub mod layer;

View file

@ -7,7 +7,7 @@ pub use crate::core::event::Status;
/// A [`Canvas`] event. /// A [`Canvas`] event.
/// ///
/// [`Canvas`]: crate::widget::Canvas /// [`Canvas`]: crate::Canvas
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq)]
pub enum Event { pub enum Event {
/// A mouse event. /// A mouse event.

View file

@ -8,7 +8,7 @@ use crate::graphics::geometry;
/// A [`Program`] can mutate internal state and produce messages for an /// A [`Program`] can mutate internal state and produce messages for an
/// application. /// application.
/// ///
/// [`Canvas`]: crate::widget::Canvas /// [`Canvas`]: crate::Canvas
pub trait Program<Message, Renderer = crate::Renderer> pub trait Program<Message, Renderer = crate::Renderer>
where where
Renderer: geometry::Renderer, Renderer: geometry::Renderer,
@ -26,7 +26,7 @@ where
/// ///
/// By default, this method does and returns nothing. /// By default, this method does and returns nothing.
/// ///
/// [`Canvas`]: crate::widget::Canvas /// [`Canvas`]: crate::Canvas
fn update( fn update(
&self, &self,
_state: &mut Self::State, _state: &mut Self::State,
@ -42,8 +42,9 @@ where
/// [`Geometry`] can be easily generated with a [`Frame`] or stored in a /// [`Geometry`] can be easily generated with a [`Frame`] or stored in a
/// [`Cache`]. /// [`Cache`].
/// ///
/// [`Frame`]: crate::widget::canvas::Frame /// [`Geometry`]: crate::canvas::Geometry
/// [`Cache`]: crate::widget::canvas::Cache /// [`Frame`]: crate::canvas::Frame
/// [`Cache`]: crate::canvas::Cache
fn draw( fn draw(
&self, &self,
state: &Self::State, state: &Self::State,
@ -58,7 +59,7 @@ where
/// The interaction returned will be in effect even if the cursor position /// The interaction returned will be in effect even if the cursor position
/// is out of bounds of the program's [`Canvas`]. /// is out of bounds of the program's [`Canvas`].
/// ///
/// [`Canvas`]: crate::widget::Canvas /// [`Canvas`]: crate::Canvas
fn mouse_interaction( fn mouse_interaction(
&self, &self,
_state: &Self::State, _state: &Self::State,

View file

@ -122,7 +122,7 @@ where
self self
} }
/// Sets the text [`LineHeight`] of the [`Checkbox`]. /// Sets the text [`text::LineHeight`] of the [`Checkbox`].
pub fn text_line_height( pub fn text_line_height(
mut self, mut self,
line_height: impl Into<text::LineHeight>, line_height: impl Into<text::LineHeight>,
@ -137,9 +137,9 @@ where
self 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 { pub fn font(mut self, font: impl Into<Renderer::Font>) -> Self {
self.font = Some(font.into()); self.font = Some(font.into());
self self

View file

@ -20,7 +20,7 @@ use std::time::Instant;
/// ///
/// This widget is composed by a [`TextInput`] that can be filled with the text /// 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 /// to search for corresponding values from the list of options that are displayed
/// as a [`Menu`]. /// as a Menu.
#[allow(missing_debug_implementations)] #[allow(missing_debug_implementations)]
pub struct ComboBox<'a, T, Message, Renderer = crate::Renderer> pub struct ComboBox<'a, T, Message, Renderer = crate::Renderer>
where where
@ -131,14 +131,16 @@ where
self 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 { pub fn font(mut self, font: Renderer::Font) -> Self {
self.text_input = self.text_input.font(font); self.text_input = self.text_input.font(font);
self.font = Some(font); self.font = Some(font);
self 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 { pub fn icon(mut self, icon: text_input::Icon<Renderer::Font>) -> Self {
self.text_input = self.text_input.icon(icon); self.text_input = self.text_input.icon(icon);
self self

View file

@ -25,7 +25,7 @@ use std::ops::RangeInclusive;
/// Creates a [`Column`] with the given children. /// Creates a [`Column`] with the given children.
/// ///
/// [`Column`]: widget::Column /// [`Column`]: crate::Column
#[macro_export] #[macro_export]
macro_rules! column { macro_rules! column {
() => ( () => (
@ -38,7 +38,7 @@ macro_rules! column {
/// Creates a [`Row`] with the given children. /// Creates a [`Row`] with the given children.
/// ///
/// [`Row`]: widget::Row /// [`Row`]: crate::Row
#[macro_export] #[macro_export]
macro_rules! row { macro_rules! row {
() => ( () => (
@ -51,7 +51,7 @@ macro_rules! row {
/// Creates a new [`Container`] with the provided content. /// Creates a new [`Container`] with the provided content.
/// ///
/// [`Container`]: widget::Container /// [`Container`]: crate::Container
pub fn container<'a, Message, Renderer>( pub fn container<'a, Message, Renderer>(
content: impl Into<Element<'a, Message, Renderer>>, content: impl Into<Element<'a, Message, Renderer>>,
) -> Container<'a, Message, Renderer> ) -> Container<'a, Message, Renderer>
@ -64,7 +64,7 @@ where
/// Creates a new [`Column`] with the given children. /// Creates a new [`Column`] with the given children.
/// ///
/// [`Column`]: widget::Column /// [`Column`]: crate::Column
pub fn column<Message, Renderer>( pub fn column<Message, Renderer>(
children: Vec<Element<'_, Message, Renderer>>, children: Vec<Element<'_, Message, Renderer>>,
) -> Column<'_, Message, Renderer> { ) -> Column<'_, Message, Renderer> {
@ -73,7 +73,7 @@ pub fn column<Message, Renderer>(
/// Creates a new [`Row`] with the given children. /// Creates a new [`Row`] with the given children.
/// ///
/// [`Row`]: widget::Row /// [`Row`]: crate::Row
pub fn row<Message, Renderer>( pub fn row<Message, Renderer>(
children: Vec<Element<'_, Message, Renderer>>, children: Vec<Element<'_, Message, Renderer>>,
) -> Row<'_, Message, Renderer> { ) -> Row<'_, Message, Renderer> {
@ -82,7 +82,7 @@ pub fn row<Message, Renderer>(
/// Creates a new [`Scrollable`] with the provided content. /// Creates a new [`Scrollable`] with the provided content.
/// ///
/// [`Scrollable`]: widget::Scrollable /// [`Scrollable`]: crate::Scrollable
pub fn scrollable<'a, Message, Renderer>( pub fn scrollable<'a, Message, Renderer>(
content: impl Into<Element<'a, Message, Renderer>>, content: impl Into<Element<'a, Message, Renderer>>,
) -> Scrollable<'a, Message, Renderer> ) -> Scrollable<'a, Message, Renderer>
@ -95,7 +95,7 @@ where
/// Creates a new [`Button`] with the provided content. /// Creates a new [`Button`] with the provided content.
/// ///
/// [`Button`]: widget::Button /// [`Button`]: crate::Button
pub fn button<'a, Message, Renderer>( pub fn button<'a, Message, Renderer>(
content: impl Into<Element<'a, Message, Renderer>>, content: impl Into<Element<'a, Message, Renderer>>,
) -> Button<'a, Message, Renderer> ) -> Button<'a, Message, Renderer>
@ -109,8 +109,8 @@ where
/// Creates a new [`Tooltip`] with the provided content, tooltip text, and [`tooltip::Position`]. /// Creates a new [`Tooltip`] with the provided content, tooltip text, and [`tooltip::Position`].
/// ///
/// [`Tooltip`]: widget::Tooltip /// [`Tooltip`]: crate::Tooltip
/// [`tooltip::Position`]: widget::tooltip::Position /// [`tooltip::Position`]: crate::tooltip::Position
pub fn tooltip<'a, Message, Renderer>( pub fn tooltip<'a, Message, Renderer>(
content: impl Into<Element<'a, Message, Renderer>>, content: impl Into<Element<'a, Message, Renderer>>,
tooltip: impl ToString, tooltip: impl ToString,
@ -125,7 +125,7 @@ where
/// Creates a new [`Text`] widget with the provided content. /// Creates a new [`Text`] widget with the provided content.
/// ///
/// [`Text`]: widget::Text /// [`Text`]: core::widget::Text
pub fn text<'a, Renderer>(text: impl ToString) -> Text<'a, Renderer> pub fn text<'a, Renderer>(text: impl ToString) -> Text<'a, Renderer>
where where
Renderer: core::text::Renderer, Renderer: core::text::Renderer,
@ -136,7 +136,7 @@ where
/// Creates a new [`Checkbox`]. /// Creates a new [`Checkbox`].
/// ///
/// [`Checkbox`]: widget::Checkbox /// [`Checkbox`]: crate::Checkbox
pub fn checkbox<'a, Message, Renderer>( pub fn checkbox<'a, Message, Renderer>(
label: impl Into<String>, label: impl Into<String>,
is_checked: bool, is_checked: bool,
@ -151,7 +151,7 @@ where
/// Creates a new [`Radio`]. /// Creates a new [`Radio`].
/// ///
/// [`Radio`]: widget::Radio /// [`Radio`]: crate::Radio
pub fn radio<Message, Renderer, V>( pub fn radio<Message, Renderer, V>(
label: impl Into<String>, label: impl Into<String>,
value: V, value: V,
@ -169,7 +169,7 @@ where
/// Creates a new [`Toggler`]. /// Creates a new [`Toggler`].
/// ///
/// [`Toggler`]: widget::Toggler /// [`Toggler`]: crate::Toggler
pub fn toggler<'a, Message, Renderer>( pub fn toggler<'a, Message, Renderer>(
label: impl Into<Option<String>>, label: impl Into<Option<String>>,
is_checked: bool, is_checked: bool,
@ -184,7 +184,7 @@ where
/// Creates a new [`TextInput`]. /// Creates a new [`TextInput`].
/// ///
/// [`TextInput`]: widget::TextInput /// [`TextInput`]: crate::TextInput
pub fn text_input<'a, Message, Renderer>( pub fn text_input<'a, Message, Renderer>(
placeholder: &str, placeholder: &str,
value: &str, value: &str,
@ -199,7 +199,7 @@ where
/// Creates a new [`Slider`]. /// Creates a new [`Slider`].
/// ///
/// [`Slider`]: widget::Slider /// [`Slider`]: crate::Slider
pub fn slider<'a, T, Message, Renderer>( pub fn slider<'a, T, Message, Renderer>(
range: std::ops::RangeInclusive<T>, range: std::ops::RangeInclusive<T>,
value: T, value: T,
@ -216,7 +216,7 @@ where
/// Creates a new [`VerticalSlider`]. /// Creates a new [`VerticalSlider`].
/// ///
/// [`VerticalSlider`]: widget::VerticalSlider /// [`VerticalSlider`]: crate::VerticalSlider
pub fn vertical_slider<'a, T, Message, Renderer>( pub fn vertical_slider<'a, T, Message, Renderer>(
range: std::ops::RangeInclusive<T>, range: std::ops::RangeInclusive<T>,
value: T, value: T,
@ -233,7 +233,7 @@ where
/// Creates a new [`PickList`]. /// Creates a new [`PickList`].
/// ///
/// [`PickList`]: widget::PickList /// [`PickList`]: crate::PickList
pub fn pick_list<'a, Message, Renderer, T>( pub fn pick_list<'a, Message, Renderer, T>(
options: impl Into<Cow<'a, [T]>>, options: impl Into<Cow<'a, [T]>>,
selected: Option<T>, selected: Option<T>,
@ -255,7 +255,7 @@ where
/// Creates a new [`ComboBox`]. /// Creates a new [`ComboBox`].
/// ///
/// [`ComboBox`]: widget::ComboBox /// [`ComboBox`]: crate::ComboBox
pub fn combo_box<'a, T, Message, Renderer>( pub fn combo_box<'a, T, Message, Renderer>(
state: &'a combo_box::State<T>, state: &'a combo_box::State<T>,
placeholder: &str, placeholder: &str,
@ -272,21 +272,21 @@ where
/// Creates a new horizontal [`Space`] with the given [`Length`]. /// Creates a new horizontal [`Space`] with the given [`Length`].
/// ///
/// [`Space`]: widget::Space /// [`Space`]: crate::Space
pub fn horizontal_space(width: impl Into<Length>) -> Space { pub fn horizontal_space(width: impl Into<Length>) -> Space {
Space::with_width(width) Space::with_width(width)
} }
/// Creates a new vertical [`Space`] with the given [`Length`]. /// Creates a new vertical [`Space`] with the given [`Length`].
/// ///
/// [`Space`]: widget::Space /// [`Space`]: crate::Space
pub fn vertical_space(height: impl Into<Length>) -> Space { pub fn vertical_space(height: impl Into<Length>) -> Space {
Space::with_height(height) Space::with_height(height)
} }
/// Creates a horizontal [`Rule`] with the given height. /// Creates a horizontal [`Rule`] with the given height.
/// ///
/// [`Rule`]: widget::Rule /// [`Rule`]: crate::Rule
pub fn horizontal_rule<Renderer>(height: impl Into<Pixels>) -> Rule<Renderer> pub fn horizontal_rule<Renderer>(height: impl Into<Pixels>) -> Rule<Renderer>
where where
Renderer: core::Renderer, Renderer: core::Renderer,
@ -297,7 +297,7 @@ where
/// Creates a vertical [`Rule`] with the given width. /// Creates a vertical [`Rule`] with the given width.
/// ///
/// [`Rule`]: widget::Rule /// [`Rule`]: crate::Rule
pub fn vertical_rule<Renderer>(width: impl Into<Pixels>) -> Rule<Renderer> pub fn vertical_rule<Renderer>(width: impl Into<Pixels>) -> Rule<Renderer>
where where
Renderer: core::Renderer, Renderer: core::Renderer,
@ -312,7 +312,7 @@ where
/// * an inclusive range of possible values, and /// * an inclusive range of possible values, and
/// * the current value of the [`ProgressBar`]. /// * the current value of the [`ProgressBar`].
/// ///
/// [`ProgressBar`]: widget::ProgressBar /// [`ProgressBar`]: crate::ProgressBar
pub fn progress_bar<Renderer>( pub fn progress_bar<Renderer>(
range: RangeInclusive<f32>, range: RangeInclusive<f32>,
value: f32, value: f32,
@ -326,7 +326,7 @@ where
/// Creates a new [`Image`]. /// Creates a new [`Image`].
/// ///
/// [`Image`]: widget::Image /// [`Image`]: crate::Image
#[cfg(feature = "image")] #[cfg(feature = "image")]
pub fn image<Handle>(handle: impl Into<Handle>) -> crate::Image<Handle> { pub fn image<Handle>(handle: impl Into<Handle>) -> crate::Image<Handle> {
crate::Image::new(handle.into()) crate::Image::new(handle.into())
@ -334,8 +334,8 @@ pub fn image<Handle>(handle: impl Into<Handle>) -> crate::Image<Handle> {
/// Creates a new [`Svg`] widget from the given [`Handle`]. /// Creates a new [`Svg`] widget from the given [`Handle`].
/// ///
/// [`Svg`]: widget::Svg /// [`Svg`]: crate::Svg
/// [`Handle`]: widget::svg::Handle /// [`Handle`]: crate::svg::Handle
#[cfg(feature = "svg")] #[cfg(feature = "svg")]
pub fn svg<Renderer>( pub fn svg<Renderer>(
handle: impl Into<core::svg::Handle>, handle: impl Into<core::svg::Handle>,
@ -348,6 +348,8 @@ where
} }
/// Creates a new [`Canvas`]. /// Creates a new [`Canvas`].
///
/// [`Canvas`]: crate::Canvas
#[cfg(feature = "canvas")] #[cfg(feature = "canvas")]
pub fn canvas<P, Message, Renderer>( pub fn canvas<P, Message, Renderer>(
program: P, program: P,

View file

@ -2,6 +2,7 @@
#![doc( #![doc(
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg" html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
)] )]
#![forbid(unsafe_code, rust_2018_idioms)]
#![deny( #![deny(
missing_debug_implementations, missing_debug_implementations,
missing_docs, missing_docs,
@ -10,9 +11,9 @@
clippy::from_over_into, clippy::from_over_into,
clippy::needless_borrow, clippy::needless_borrow,
clippy::new_without_default, 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)] #![allow(clippy::inherent_to_string, clippy::type_complexity)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(docsrs, feature(doc_auto_cfg))]
pub use iced_renderer as renderer; pub use iced_renderer as renderer;

View file

@ -89,7 +89,7 @@ where
self self
} }
/// Sets the text [`LineHeight`] of the [`Menu`]. /// Sets the text [`text::LineHeight`] of the [`Menu`].
pub fn text_line_height( pub fn text_line_height(
mut self, mut self,
line_height: impl Into<text::LineHeight>, line_height: impl Into<text::LineHeight>,

View file

@ -2,7 +2,7 @@ use crate::pane_grid::Axis;
/// The arrangement of a [`PaneGrid`]. /// The arrangement of a [`PaneGrid`].
/// ///
/// [`PaneGrid`]: crate::widget::PaneGrid /// [`PaneGrid`]: super::PaneGrid
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum Configuration<T> { pub enum Configuration<T> {
/// A split of the available space. /// A split of the available space.
@ -21,6 +21,6 @@ pub enum Configuration<T> {
}, },
/// A [`Pane`]. /// A [`Pane`].
/// ///
/// [`Pane`]: crate::widget::pane_grid::Pane /// [`Pane`]: super::Pane
Pane(T), Pane(T),
} }

View file

@ -10,7 +10,7 @@ use crate::pane_grid::{Draggable, TitleBar};
/// The content of a [`Pane`]. /// The content of a [`Pane`].
/// ///
/// [`Pane`]: crate::widget::pane_grid::Pane /// [`Pane`]: super::Pane
#[allow(missing_debug_implementations)] #[allow(missing_debug_implementations)]
pub struct Content<'a, Message, Renderer = crate::Renderer> pub struct Content<'a, Message, Renderer = crate::Renderer>
where where
@ -87,7 +87,7 @@ where
/// Draws the [`Content`] with the provided [`Renderer`] and [`Layout`]. /// Draws the [`Content`] with the provided [`Renderer`] and [`Layout`].
/// ///
/// [`Renderer`]: crate::Renderer /// [`Renderer`]: crate::core::Renderer
pub fn draw( pub fn draw(
&self, &self,
tree: &Tree, tree: &Tree,

View file

@ -5,7 +5,7 @@ use std::collections::BTreeMap;
/// A layout node of a [`PaneGrid`]. /// A layout node of a [`PaneGrid`].
/// ///
/// [`PaneGrid`]: crate::widget::PaneGrid /// [`PaneGrid`]: super::PaneGrid
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum Node { pub enum Node {
/// The region of this [`Node`] is split into two. /// The region of this [`Node`] is split into two.

View file

@ -1,5 +1,5 @@
/// A rectangular region in a [`PaneGrid`] used to display widgets. /// A rectangular region in a [`PaneGrid`] used to display widgets.
/// ///
/// [`PaneGrid`]: crate::widget::PaneGrid /// [`PaneGrid`]: super::PaneGrid
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Pane(pub(super) usize); pub struct Pane(pub(super) usize);

View file

@ -1,5 +1,5 @@
/// A divider that splits a region in a [`PaneGrid`] into two different panes. /// A divider that splits a region in a [`PaneGrid`] into two different panes.
/// ///
/// [`PaneGrid`]: crate::widget::PaneGrid /// [`PaneGrid`]: super::PaneGrid
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Split(pub(super) usize); pub struct Split(pub(super) usize);

View file

@ -1,6 +1,6 @@
//! The state of a [`PaneGrid`]. //! The state of a [`PaneGrid`].
//! //!
//! [`PaneGrid`]: crate::widget::PaneGrid //! [`PaneGrid`]: super::PaneGrid
use crate::core::{Point, Size}; use crate::core::{Point, Size};
use crate::pane_grid::{ use crate::pane_grid::{
Axis, Configuration, Direction, Edge, Node, Pane, Region, Split, Target, Axis, Configuration, Direction, Edge, Node, Pane, Region, Split, Target,
@ -18,23 +18,23 @@ use std::collections::HashMap;
/// provided to the view function of [`PaneGrid::new`] for displaying each /// provided to the view function of [`PaneGrid::new`] for displaying each
/// [`Pane`]. /// [`Pane`].
/// ///
/// [`PaneGrid`]: crate::widget::PaneGrid /// [`PaneGrid`]: super::PaneGrid
/// [`PaneGrid::new`]: crate::widget::PaneGrid::new /// [`PaneGrid::new`]: super::PaneGrid::new
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct State<T> { pub struct State<T> {
/// The panes of the [`PaneGrid`]. /// The panes of the [`PaneGrid`].
/// ///
/// [`PaneGrid`]: crate::widget::PaneGrid /// [`PaneGrid`]: super::PaneGrid
pub panes: HashMap<Pane, T>, pub panes: HashMap<Pane, T>,
/// The internal state of the [`PaneGrid`]. /// The internal state of the [`PaneGrid`].
/// ///
/// [`PaneGrid`]: crate::widget::PaneGrid /// [`PaneGrid`]: super::PaneGrid
pub internal: Internal, pub internal: Internal,
/// The maximized [`Pane`] of the [`PaneGrid`]. /// The maximized [`Pane`] of the [`PaneGrid`].
/// ///
/// [`PaneGrid`]: crate::widget::PaneGrid /// [`PaneGrid`]: super::PaneGrid
pub(super) maximized: Option<Pane>, pub(super) maximized: Option<Pane>,
} }
@ -236,6 +236,8 @@ impl<T> State<T> {
} }
/// Move [`Pane`] to an [`Edge`] of the [`PaneGrid`]. /// Move [`Pane`] to an [`Edge`] of the [`PaneGrid`].
///
/// [`PaneGrid`]: super::PaneGrid
pub fn move_to_edge(&mut self, pane: &Pane, edge: Edge) { pub fn move_to_edge(&mut self, pane: &Pane, edge: Edge) {
match edge { match edge {
Edge::Top => { Edge::Top => {
@ -269,8 +271,8 @@ impl<T> State<T> {
/// If you want to swap panes on drag and drop in your [`PaneGrid`], you /// If you want to swap panes on drag and drop in your [`PaneGrid`], you
/// will need to call this method when handling a [`DragEvent`]. /// will need to call this method when handling a [`DragEvent`].
/// ///
/// [`PaneGrid`]: crate::widget::PaneGrid /// [`PaneGrid`]: super::PaneGrid
/// [`DragEvent`]: crate::widget::pane_grid::DragEvent /// [`DragEvent`]: super::DragEvent
pub fn swap(&mut self, a: &Pane, b: &Pane) { pub fn swap(&mut self, a: &Pane, b: &Pane) {
self.internal.layout.update(&|node| match node { self.internal.layout.update(&|node| match node {
Node::Split { .. } => {} Node::Split { .. } => {}
@ -292,8 +294,8 @@ impl<T> State<T> {
/// If you want to enable resize interactions in your [`PaneGrid`], you will /// If you want to enable resize interactions in your [`PaneGrid`], you will
/// need to call this method when handling a [`ResizeEvent`]. /// need to call this method when handling a [`ResizeEvent`].
/// ///
/// [`PaneGrid`]: crate::widget::PaneGrid /// [`PaneGrid`]: super::PaneGrid
/// [`ResizeEvent`]: crate::widget::pane_grid::ResizeEvent /// [`ResizeEvent`]: super::ResizeEvent
pub fn resize(&mut self, split: &Split, ratio: f32) { pub fn resize(&mut self, split: &Split, ratio: f32) {
let _ = self.internal.layout.resize(split, ratio); let _ = self.internal.layout.resize(split, ratio);
} }
@ -315,7 +317,7 @@ impl<T> State<T> {
/// Maximize the given [`Pane`]. Only this pane will be rendered by the /// Maximize the given [`Pane`]. Only this pane will be rendered by the
/// [`PaneGrid`] until [`Self::restore()`] is called. /// [`PaneGrid`] until [`Self::restore()`] is called.
/// ///
/// [`PaneGrid`]: crate::widget::PaneGrid /// [`PaneGrid`]: super::PaneGrid
pub fn maximize(&mut self, pane: &Pane) { pub fn maximize(&mut self, pane: &Pane) {
self.maximized = Some(*pane); self.maximized = Some(*pane);
} }
@ -323,14 +325,14 @@ impl<T> State<T> {
/// Restore the currently maximized [`Pane`] to it's normal size. All panes /// Restore the currently maximized [`Pane`] to it's normal size. All panes
/// will be rendered by the [`PaneGrid`]. /// will be rendered by the [`PaneGrid`].
/// ///
/// [`PaneGrid`]: crate::widget::PaneGrid /// [`PaneGrid`]: super::PaneGrid
pub fn restore(&mut self) { pub fn restore(&mut self) {
let _ = self.maximized.take(); let _ = self.maximized.take();
} }
/// Returns the maximized [`Pane`] of the [`PaneGrid`]. /// Returns the maximized [`Pane`] of the [`PaneGrid`].
/// ///
/// [`PaneGrid`]: crate::widget::PaneGrid /// [`PaneGrid`]: super::PaneGrid
pub fn maximized(&self) -> Option<Pane> { pub fn maximized(&self) -> Option<Pane> {
self.maximized self.maximized
} }
@ -338,7 +340,7 @@ impl<T> State<T> {
/// The internal state of a [`PaneGrid`]. /// The internal state of a [`PaneGrid`].
/// ///
/// [`PaneGrid`]: crate::widget::PaneGrid /// [`PaneGrid`]: super::PaneGrid
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Internal { pub struct Internal {
layout: Node, layout: Node,
@ -349,7 +351,7 @@ impl Internal {
/// Initializes the [`Internal`] state of a [`PaneGrid`] from a /// Initializes the [`Internal`] state of a [`PaneGrid`] from a
/// [`Configuration`]. /// [`Configuration`].
/// ///
/// [`PaneGrid`]: crate::widget::PaneGrid /// [`PaneGrid`]: super::PaneGrid
pub fn from_configuration<T>( pub fn from_configuration<T>(
panes: &mut HashMap<Pane, T>, panes: &mut HashMap<Pane, T>,
content: Configuration<T>, content: Configuration<T>,
@ -394,16 +396,16 @@ impl Internal {
/// The current action of a [`PaneGrid`]. /// The current action of a [`PaneGrid`].
/// ///
/// [`PaneGrid`]: crate::widget::PaneGrid /// [`PaneGrid`]: super::PaneGrid
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq)]
pub enum Action { pub enum Action {
/// The [`PaneGrid`] is idle. /// The [`PaneGrid`] is idle.
/// ///
/// [`PaneGrid`]: crate::widget::PaneGrid /// [`PaneGrid`]: super::PaneGrid
Idle, Idle,
/// A [`Pane`] in the [`PaneGrid`] is being dragged. /// A [`Pane`] in the [`PaneGrid`] is being dragged.
/// ///
/// [`PaneGrid`]: crate::widget::PaneGrid /// [`PaneGrid`]: super::PaneGrid
Dragging { Dragging {
/// The [`Pane`] being dragged. /// The [`Pane`] being dragged.
pane: Pane, pane: Pane,
@ -412,7 +414,7 @@ pub enum Action {
}, },
/// A [`Split`] in the [`PaneGrid`] is being dragged. /// A [`Split`] in the [`PaneGrid`] is being dragged.
/// ///
/// [`PaneGrid`]: crate::widget::PaneGrid /// [`PaneGrid`]: super::PaneGrid
Resizing { Resizing {
/// The [`Split`] being dragged. /// The [`Split`] being dragged.
split: Split, split: Split,

View file

@ -11,7 +11,7 @@ use crate::core::{
/// The title bar of a [`Pane`]. /// The title bar of a [`Pane`].
/// ///
/// [`Pane`]: crate::widget::pane_grid::Pane /// [`Pane`]: super::Pane
#[allow(missing_debug_implementations)] #[allow(missing_debug_implementations)]
pub struct TitleBar<'a, Message, Renderer = crate::Renderer> pub struct TitleBar<'a, Message, Renderer = crate::Renderer>
where where
@ -75,7 +75,7 @@ where
/// [`TitleBar`] is hovered. /// [`TitleBar`] is hovered.
/// ///
/// [`controls`]: Self::controls /// [`controls`]: Self::controls
/// [`Pane`]: crate::widget::pane_grid::Pane /// [`Pane`]: super::Pane
pub fn always_show_controls(mut self) -> Self { pub fn always_show_controls(mut self) -> Self {
self.always_show_controls = true; self.always_show_controls = true;
self self
@ -114,7 +114,7 @@ where
/// Draws the [`TitleBar`] with the provided [`Renderer`] and [`Layout`]. /// Draws the [`TitleBar`] with the provided [`Renderer`] and [`Layout`].
/// ///
/// [`Renderer`]: crate::Renderer /// [`Renderer`]: crate::core::Renderer
pub fn draw( pub fn draw(
&self, &self,
tree: &Tree, tree: &Tree,

View file

@ -105,7 +105,7 @@ where
self self
} }
/// Sets the text [`LineHeight`] of the [`PickList`]. /// Sets the text [`text::LineHeight`] of the [`PickList`].
pub fn text_line_height( pub fn text_line_height(
mut self, mut self,
line_height: impl Into<text::LineHeight>, line_height: impl Into<text::LineHeight>,

View file

@ -156,7 +156,7 @@ where
self self
} }
/// Sets the text [`LineHeight`] of the [`Radio`] button. /// Sets the text [`text::LineHeight`] of the [`Radio`] button.
pub fn text_line_height( pub fn text_line_height(
mut self, mut self,
line_height: impl Into<text::LineHeight>, line_height: impl Into<text::LineHeight>,

View file

@ -182,7 +182,7 @@ where
self self
} }
/// Sets the [`LineHeight`] of the [`TextInput`]. /// Sets the [`text::LineHeight`] of the [`TextInput`].
pub fn line_height( pub fn line_height(
mut self, mut self,
line_height: impl Into<text::LineHeight>, line_height: impl Into<text::LineHeight>,

View file

@ -2,7 +2,7 @@ use unicode_segmentation::UnicodeSegmentation;
/// The value of a [`TextInput`]. /// The value of a [`TextInput`].
/// ///
/// [`TextInput`]: crate::widget::TextInput /// [`TextInput`]: super::TextInput
// TODO: Reduce allocations, cache results (?) // TODO: Reduce allocations, cache results (?)
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Value { pub struct Value {

View file

@ -109,7 +109,7 @@ where
self self
} }
/// Sets the text [`LineHeight`] of the [`Toggler`]. /// Sets the text [`text::LineHeight`] of the [`Toggler`].
pub fn text_line_height( pub fn text_line_height(
mut self, mut self,
line_height: impl Into<text::LineHeight>, line_height: impl Into<text::LineHeight>,
@ -136,9 +136,9 @@ where
self self
} }
/// Sets the [`Font`] of the text of the [`Toggler`] /// Sets the [`Renderer::Font`] of the text of the [`Toggler`]
/// ///
/// [`Font`]: crate::text::Renderer::Font /// [`Renderer::Font`]: crate::core::text::Renderer
pub fn font(mut self, font: impl Into<Renderer::Font>) -> Self { pub fn font(mut self, font: impl Into<Renderer::Font>) -> Self {
self.font = Some(font.into()); self.font = Some(font.into());
self self

View file

@ -184,9 +184,7 @@ where
/// window. /// window.
/// ///
/// Normally an [`Application`] should be synchronized with its [`State`] /// Normally an [`Application`] should be synchronized with its [`State`]
/// and window after calling [`Application::update`]. /// and window after calling [`crate::application::update`].
///
/// [`Application::update`]: crate::Program::update
pub fn synchronize(&mut self, application: &A, window: &Window) { pub fn synchronize(&mut self, application: &A, window: &Window) {
// Update window title // Update window title
let new_title = application.title(); let new_title = application.title();

View file

@ -521,7 +521,7 @@ pub fn user_attention(
} }
} }
/// Converts some [`Icon`] into it's `winit` counterpart. /// Converts some [`window::Icon`] into it's `winit` counterpart.
/// ///
/// Returns `None` if there is an error during the conversion. /// Returns `None` if there is an error during the conversion.
pub fn icon(icon: window::Icon) -> Option<winit::window::Icon> { pub fn icon(icon: window::Icon) -> Option<winit::window::Icon> {

View file

@ -17,6 +17,7 @@
#![doc( #![doc(
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg" html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
)] )]
#![forbid(rust_2018_idioms)]
#![deny( #![deny(
missing_debug_implementations, missing_debug_implementations,
missing_docs, missing_docs,
@ -26,9 +27,9 @@
clippy::needless_borrow, clippy::needless_borrow,
clippy::new_without_default, clippy::new_without_default,
clippy::useless_conversion, clippy::useless_conversion,
unsafe_code unsafe_code,
rustdoc::broken_intra_doc_links
)] )]
#![forbid(rust_2018_idioms)]
#![allow(clippy::inherent_to_string, clippy::type_complexity)] #![allow(clippy::inherent_to_string, clippy::type_complexity)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(docsrs, feature(doc_auto_cfg))]
pub use iced_graphics as graphics; pub use iced_graphics as graphics;