Use recently stabilized intra-doc links

See RFC: https://github.com/rust-lang/rfcs/blob/master/text/1946-intra-rustdoc-links.md
This commit is contained in:
Héctor Ramón Jiménez 2020-11-25 07:11:27 +01:00
parent d612bf5678
commit 01322f69a4
135 changed files with 135 additions and 1769 deletions

View File

@ -26,8 +26,6 @@ impl Length {
/// The _fill factor_ is a relative unit describing how much of the /// The _fill factor_ is a relative unit describing how much of the
/// remaining space should be filled when compared to other elements. It /// remaining space should be filled when compared to other elements. It
/// is only meant to be used by layout engines. /// is only meant to be used by layout engines.
///
/// [`Length`]: enum.Length.html
pub fn fill_factor(&self) -> u16 { pub fn fill_factor(&self) -> u16 {
match self { match self {
Length::Fill => 1, Length::Fill => 1,

View File

@ -12,20 +12,14 @@ pub struct Point {
impl Point { impl Point {
/// The origin (i.e. a [`Point`] at (0, 0)). /// The origin (i.e. a [`Point`] at (0, 0)).
///
/// [`Point`]: struct.Point.html
pub const ORIGIN: Point = Point::new(0.0, 0.0); pub const ORIGIN: Point = Point::new(0.0, 0.0);
/// Creates a new [`Point`] with the given coordinates. /// Creates a new [`Point`] with the given coordinates.
///
/// [`Point`]: struct.Point.html
pub const fn new(x: f32, y: f32) -> Self { pub const fn new(x: f32, y: f32) -> Self {
Self { x, y } Self { x, y }
} }
/// Computes the distance to another [`Point`]. /// Computes the distance to another [`Point`].
///
/// [`Point`]: struct.Point.html
pub fn distance(&self, to: Point) -> f32 { pub fn distance(&self, to: Point) -> f32 {
let a = self.x - to.x; let a = self.x - to.x;
let b = self.y - to.y; let b = self.y - to.y;

View File

@ -19,10 +19,6 @@ pub struct Rectangle<T = f32> {
impl Rectangle<f32> { impl Rectangle<f32> {
/// Creates a new [`Rectangle`] with its top-left corner in the given /// Creates a new [`Rectangle`] with its top-left corner in the given
/// [`Point`] and with the provided [`Size`]. /// [`Point`] and with the provided [`Size`].
///
/// [`Rectangle`]: struct.Rectangle.html
/// [`Point`]: struct.Point.html
/// [`Size`]: struct.Size.html
pub fn new(top_left: Point, size: Size) -> Self { pub fn new(top_left: Point, size: Size) -> Self {
Self { Self {
x: top_left.x, x: top_left.x,
@ -34,9 +30,6 @@ impl Rectangle<f32> {
/// Creates a new [`Rectangle`] with its top-left corner at the origin /// Creates a new [`Rectangle`] with its top-left corner at the origin
/// and with the provided [`Size`]. /// and with the provided [`Size`].
///
/// [`Rectangle`]: struct.Rectangle.html
/// [`Size`]: struct.Size.html
pub fn with_size(size: Size) -> Self { pub fn with_size(size: Size) -> Self {
Self { Self {
x: 0.0, x: 0.0,
@ -47,50 +40,33 @@ impl Rectangle<f32> {
} }
/// Returns the [`Point`] at the center of the [`Rectangle`]. /// Returns the [`Point`] at the center of the [`Rectangle`].
///
/// [`Point`]: struct.Point.html
/// [`Rectangle`]: struct.Rectangle.html
pub fn center(&self) -> Point { pub fn center(&self) -> Point {
Point::new(self.center_x(), self.center_y()) Point::new(self.center_x(), self.center_y())
} }
/// Returns the X coordinate of the [`Point`] at the center of the /// Returns the X coordinate of the [`Point`] at the center of the
/// [`Rectangle`]. /// [`Rectangle`].
///
/// [`Point`]: struct.Point.html
/// [`Rectangle`]: struct.Rectangle.html
pub fn center_x(&self) -> f32 { pub fn center_x(&self) -> f32 {
self.x + self.width / 2.0 self.x + self.width / 2.0
} }
/// Returns the Y coordinate of the [`Point`] at the center of the /// Returns the Y coordinate of the [`Point`] at the center of the
/// [`Rectangle`]. /// [`Rectangle`].
///
/// [`Point`]: struct.Point.html
/// [`Rectangle`]: struct.Rectangle.html
pub fn center_y(&self) -> f32 { pub fn center_y(&self) -> f32 {
self.y + self.height / 2.0 self.y + self.height / 2.0
} }
/// Returns the position of the top left corner of the [`Rectangle`]. /// Returns the position of the top left corner of the [`Rectangle`].
///
/// [`Rectangle`]: struct.Rectangle.html
pub fn position(&self) -> Point { pub fn position(&self) -> Point {
Point::new(self.x, self.y) Point::new(self.x, self.y)
} }
/// Returns the [`Size`] of the [`Rectangle`]. /// Returns the [`Size`] of the [`Rectangle`].
///
/// [`Size`]: struct.Size.html
/// [`Rectangle`]: struct.Rectangle.html
pub fn size(&self) -> Size { pub fn size(&self) -> Size {
Size::new(self.width, self.height) Size::new(self.width, self.height)
} }
/// Returns true if the given [`Point`] is contained in the [`Rectangle`]. /// Returns true if the given [`Point`] is contained in the [`Rectangle`].
///
/// [`Point`]: struct.Point.html
/// [`Rectangle`]: struct.Rectangle.html
pub fn contains(&self, point: Point) -> bool { pub fn contains(&self, point: Point) -> bool {
self.x <= point.x self.x <= point.x
&& point.x <= self.x + self.width && point.x <= self.x + self.width
@ -99,8 +75,6 @@ impl Rectangle<f32> {
} }
/// Computes the intersection with the given [`Rectangle`]. /// Computes the intersection with the given [`Rectangle`].
///
/// [`Rectangle`]: struct.Rectangle.html
pub fn intersection( pub fn intersection(
&self, &self,
other: &Rectangle<f32>, other: &Rectangle<f32>,
@ -127,8 +101,6 @@ impl Rectangle<f32> {
} }
/// Snaps the [`Rectangle`] to __unsigned__ integer coordinates. /// Snaps the [`Rectangle`] to __unsigned__ integer coordinates.
///
/// [`Rectangle`]: struct.Rectangle.html
pub fn snap(self) -> Rectangle<u32> { pub fn snap(self) -> Rectangle<u32> {
Rectangle { Rectangle {
x: self.x as u32, x: self.x as u32,

View File

@ -12,8 +12,6 @@ pub struct Size<T = f32> {
impl<T> Size<T> { impl<T> Size<T> {
/// Creates a new [`Size`] with the given width and height. /// Creates a new [`Size`] with the given width and height.
///
/// [`Size`]: struct.Size.html
pub const fn new(width: T, height: T) -> Self { pub const fn new(width: T, height: T) -> Self {
Size { width, height } Size { width, height }
} }
@ -21,23 +19,15 @@ impl<T> Size<T> {
impl Size { impl Size {
/// A [`Size`] with zero width and height. /// A [`Size`] with zero width and height.
///
/// [`Size`]: struct.Size.html
pub const ZERO: Size = Size::new(0., 0.); pub const ZERO: Size = Size::new(0., 0.);
/// A [`Size`] with a width and height of 1 unit. /// A [`Size`] with a width and height of 1 unit.
///
/// [`Size`]: struct.Size.html
pub const UNIT: Size = Size::new(1., 1.); pub const UNIT: Size = Size::new(1., 1.);
/// A [`Size`] with infinite width and height. /// A [`Size`] with infinite width and height.
///
/// [`Size`]: struct.Size.html
pub const INFINITY: Size = Size::new(f32::INFINITY, f32::INFINITY); pub const INFINITY: Size = Size::new(f32::INFINITY, f32::INFINITY);
/// Increments the [`Size`] to account for the given padding. /// Increments the [`Size`] to account for the given padding.
///
/// [`Size`]: struct.Size.html
pub fn pad(&self, padding: f32) -> Self { pub fn pad(&self, padding: f32) -> Self {
Size { Size {
width: self.width + padding * 2.0, width: self.width + padding * 2.0,

View File

@ -2,20 +2,14 @@
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq)]
pub struct Vector<T = f32> { pub struct Vector<T = f32> {
/// The X component of the [`Vector`] /// The X component of the [`Vector`]
///
/// [`Vector`]: struct.Vector.html
pub x: T, pub x: T,
/// The Y component of the [`Vector`] /// The Y component of the [`Vector`]
///
/// [`Vector`]: struct.Vector.html
pub y: T, pub y: T,
} }
impl<T> Vector<T> { impl<T> Vector<T> {
/// Creates a new [`Vector`] with the given components. /// Creates a new [`Vector`] with the given components.
///
/// [`Vector`]: struct.Vector.html
pub const fn new(x: T, y: T) -> Self { pub const fn new(x: T, y: T) -> Self {
Self { x, y } Self { x, y }
} }

View File

@ -5,9 +5,6 @@ use futures::future::{Future, FutureExt};
/// ///
/// You should be able to turn a future easily into a [`Command`], either by /// You should be able to turn a future easily into a [`Command`], either by
/// using the `From` trait or [`Command::perform`]. /// using the `From` trait or [`Command::perform`].
///
/// [`Command`]: struct.Command.html
/// [`Command::perform`]: #method.perform
pub struct Command<T> { pub struct Command<T> {
futures: Vec<BoxFuture<T>>, futures: Vec<BoxFuture<T>>,
} }
@ -16,8 +13,6 @@ impl<T> Command<T> {
/// Creates an empty [`Command`]. /// Creates an empty [`Command`].
/// ///
/// In other words, a [`Command`] that does nothing. /// In other words, a [`Command`] that does nothing.
///
/// [`Command`]: struct.Command.html
pub fn none() -> Self { pub fn none() -> Self {
Self { Self {
futures: Vec::new(), futures: Vec::new(),
@ -25,8 +20,6 @@ impl<T> Command<T> {
} }
/// Creates a [`Command`] that performs the action of the given future. /// Creates a [`Command`] that performs the action of the given future.
///
/// [`Command`]: struct.Command.html
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
pub fn perform<A>( pub fn perform<A>(
future: impl Future<Output = T> + 'static + Send, future: impl Future<Output = T> + 'static + Send,
@ -38,8 +31,6 @@ impl<T> Command<T> {
} }
/// Creates a [`Command`] that performs the action of the given future. /// Creates a [`Command`] that performs the action of the given future.
///
/// [`Command`]: struct.Command.html
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
pub fn perform<A>( pub fn perform<A>(
future: impl Future<Output = T> + 'static, future: impl Future<Output = T> + 'static,
@ -51,8 +42,6 @@ impl<T> Command<T> {
} }
/// Applies a transformation to the result of a [`Command`]. /// Applies a transformation to the result of a [`Command`].
///
/// [`Command`]: struct.Command.html
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
pub fn map<A>( pub fn map<A>(
mut self, mut self,
@ -78,8 +67,6 @@ impl<T> Command<T> {
} }
/// Applies a transformation to the result of a [`Command`]. /// Applies a transformation to the result of a [`Command`].
///
/// [`Command`]: struct.Command.html
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
pub fn map<A>(mut self, f: impl Fn(T) -> A + 'static) -> Command<A> pub fn map<A>(mut self, f: impl Fn(T) -> A + 'static) -> Command<A>
where where
@ -105,8 +92,6 @@ impl<T> Command<T> {
/// commands. /// commands.
/// ///
/// Once this command is run, all the commands will be executed at once. /// Once this command is run, all the commands will be executed at once.
///
/// [`Command`]: struct.Command.html
pub fn batch(commands: impl IntoIterator<Item = Command<T>>) -> Self { pub fn batch(commands: impl IntoIterator<Item = Command<T>>) -> Self {
Self { Self {
futures: commands futures: commands
@ -117,8 +102,6 @@ impl<T> Command<T> {
} }
/// Converts a [`Command`] into its underlying list of futures. /// Converts a [`Command`] into its underlying list of futures.
///
/// [`Command`]: struct.Command.html
pub fn futures(self) -> Vec<BoxFuture<T>> { pub fn futures(self) -> Vec<BoxFuture<T>> {
self.futures self.futures
} }

View File

@ -38,21 +38,15 @@ use futures::Future;
/// A type that can run futures. /// A type that can run futures.
pub trait Executor: Sized { pub trait Executor: Sized {
/// Creates a new [`Executor`]. /// Creates a new [`Executor`].
///
/// [`Executor`]: trait.Executor.html
fn new() -> Result<Self, futures::io::Error> fn new() -> Result<Self, futures::io::Error>
where where
Self: Sized; Self: Sized;
/// Spawns a future in the [`Executor`]. /// Spawns a future in the [`Executor`].
///
/// [`Executor`]: trait.Executor.html
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
fn spawn(&self, future: impl Future<Output = ()> + Send + 'static); fn spawn(&self, future: impl Future<Output = ()> + Send + 'static);
/// Spawns a local future in the [`Executor`]. /// Spawns a local future in the [`Executor`].
///
/// [`Executor`]: trait.Executor.html
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
fn spawn(&self, future: impl Future<Output = ()> + 'static); fn spawn(&self, future: impl Future<Output = ()> + 'static);
@ -62,8 +56,6 @@ pub trait Executor: Sized {
/// before creating futures. This method can be leveraged to set up this /// before creating futures. This method can be leveraged to set up this
/// global state, call a function, restore the state, and obtain the result /// global state, call a function, restore the state, and obtain the result
/// of the call. /// of the call.
///
/// [`Executor`]: trait.Executor.html
fn enter<R>(&self, f: impl FnOnce() -> R) -> R { fn enter<R>(&self, f: impl FnOnce() -> R) -> R {
f() f()
} }

View File

@ -8,11 +8,6 @@ use std::marker::PhantomData;
/// ///
/// 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!
///
/// [`Runtime`]: struct.Runtime.html
/// [`Executor`]: executor/trait.Executor.html
/// [`Command`]: struct.Command.html
/// [`Subscription`]: subscription/struct.Subscription.html
#[derive(Debug)] #[derive(Debug)]
pub struct Runtime<Hasher, Event, Executor, Sender, Message> { pub struct Runtime<Hasher, Event, Executor, Sender, Message> {
executor: Executor, executor: Executor,
@ -36,8 +31,6 @@ where
/// You need to provide: /// You need to provide:
/// - an [`Executor`] to spawn futures /// - an [`Executor`] to spawn futures
/// - a `Sender` implementing `Sink` to receive the results /// - a `Sender` implementing `Sink` to receive the results
///
/// [`Runtime`]: struct.Runtime.html
pub fn new(executor: Executor, sender: Sender) -> Self { pub fn new(executor: Executor, sender: Sender) -> Self {
Self { Self {
executor, executor,
@ -50,10 +43,6 @@ where
/// Runs the given closure inside the [`Executor`] of the [`Runtime`]. /// Runs the given closure inside the [`Executor`] of the [`Runtime`].
/// ///
/// See [`Executor::enter`] to learn more. /// See [`Executor::enter`] to learn more.
///
/// [`Executor`]: executor/trait.Executor.html
/// [`Runtime`]: struct.Runtime.html
/// [`Executor::enter`]: executor/trait.Executor.html#method.enter
pub fn enter<R>(&self, f: impl FnOnce() -> R) -> R { pub fn enter<R>(&self, f: impl FnOnce() -> R) -> R {
self.executor.enter(f) self.executor.enter(f)
} }
@ -62,9 +51,6 @@ where
/// ///
/// The resulting `Message` will be forwarded to the `Sender` of the /// The resulting `Message` will be forwarded to the `Sender` of the
/// [`Runtime`]. /// [`Runtime`].
///
/// [`Command`]: struct.Command.html
/// [`Runtime`]: struct.Runtime.html
pub fn spawn(&mut self, command: Command<Message>) { pub fn spawn(&mut self, command: Command<Message>) {
use futures::{FutureExt, SinkExt}; use futures::{FutureExt, SinkExt};
@ -88,9 +74,7 @@ where
/// It will spawn new streams or close old ones as necessary! See /// It will spawn new streams or close old ones as necessary! See
/// [`Tracker::update`] to learn more about this! /// [`Tracker::update`] to learn more about this!
/// ///
/// [`Subscription`]: subscription/struct.Subscription.html /// [`Tracker::update`]: subscription::Tracker::update
/// [`Runtime`]: struct.Runtime.html
/// [`Tracker::update`]: subscription/struct.Tracker.html#method.update
pub fn track( pub fn track(
&mut self, &mut self,
subscription: Subscription<Hasher, Event, Message>, subscription: Subscription<Hasher, Event, Message>,
@ -115,9 +99,7 @@ where
/// ///
/// See [`Tracker::broadcast`] to learn more. /// See [`Tracker::broadcast`] to learn more.
/// ///
/// [`Runtime`]: struct.Runtime.html /// [`Tracker::broadcast`]: subscription::Tracker::broadcast
/// [`Tracker::broadcast`]:
/// subscription/struct.Tracker.html#method.broadcast
pub fn broadcast(&mut self, event: Event) { pub fn broadcast(&mut self, event: Event) {
self.subscriptions.broadcast(event); self.subscriptions.broadcast(event);
} }

View File

@ -19,8 +19,7 @@ use crate::BoxStream;
/// This type is normally aliased by runtimes with a specific `Event` and/or /// This type is normally aliased by runtimes with a specific `Event` and/or
/// `Hasher`. /// `Hasher`.
/// ///
/// [`Command`]: ../struct.Command.html /// [`Command`]: crate::Command
/// [`Subscription`]: struct.Subscription.html
pub struct Subscription<Hasher, Event, Output> { pub struct Subscription<Hasher, Event, Output> {
recipes: Vec<Box<dyn Recipe<Hasher, Event, Output = Output>>>, recipes: Vec<Box<dyn Recipe<Hasher, Event, Output = Output>>>,
} }
@ -30,8 +29,6 @@ where
H: std::hash::Hasher, H: std::hash::Hasher,
{ {
/// Returns an empty [`Subscription`] that will not produce any output. /// Returns an empty [`Subscription`] that will not produce any output.
///
/// [`Subscription`]: struct.Subscription.html
pub fn none() -> Self { pub fn none() -> Self {
Self { Self {
recipes: Vec::new(), recipes: Vec::new(),
@ -39,9 +36,6 @@ where
} }
/// Creates a [`Subscription`] from a [`Recipe`] describing it. /// Creates a [`Subscription`] from a [`Recipe`] describing it.
///
/// [`Subscription`]: struct.Subscription.html
/// [`Recipe`]: trait.Recipe.html
pub fn from_recipe( pub fn from_recipe(
recipe: impl Recipe<H, E, Output = O> + 'static, recipe: impl Recipe<H, E, Output = O> + 'static,
) -> Self { ) -> Self {
@ -52,8 +46,6 @@ where
/// Batches all the provided subscriptions and returns the resulting /// Batches all the provided subscriptions and returns the resulting
/// [`Subscription`]. /// [`Subscription`].
///
/// [`Subscription`]: struct.Subscription.html
pub fn batch( pub fn batch(
subscriptions: impl IntoIterator<Item = Subscription<H, E, O>>, subscriptions: impl IntoIterator<Item = Subscription<H, E, O>>,
) -> Self { ) -> Self {
@ -66,8 +58,6 @@ where
} }
/// Returns the different recipes of the [`Subscription`]. /// Returns the different recipes of the [`Subscription`].
///
/// [`Subscription`]: struct.Subscription.html
pub fn recipes(self) -> Vec<Box<dyn Recipe<H, E, Output = O>>> { pub fn recipes(self) -> Vec<Box<dyn Recipe<H, E, Output = O>>> {
self.recipes self.recipes
} }
@ -75,8 +65,6 @@ where
/// Adds a value to the [`Subscription`] context. /// Adds a value to the [`Subscription`] context.
/// ///
/// The value will be part of the identity of a [`Subscription`]. /// The value will be part of the identity of a [`Subscription`].
///
/// [`Subscription`]: struct.Subscription.html
pub fn with<T>(mut self, value: T) -> Subscription<H, E, (T, O)> pub fn with<T>(mut self, value: T) -> Subscription<H, E, (T, O)>
where where
H: 'static, H: 'static,
@ -97,8 +85,6 @@ where
} }
/// Transforms the [`Subscription`] output with the given function. /// Transforms the [`Subscription`] output with the given function.
///
/// [`Subscription`]: struct.Subscription.html
pub fn map<A>(mut self, f: fn(O) -> A) -> Subscription<H, E, A> pub fn map<A>(mut self, f: fn(O) -> A) -> Subscription<H, E, A>
where where
H: 'static, H: 'static,
@ -131,9 +117,6 @@ impl<I, O, H> std::fmt::Debug for Subscription<I, O, H> {
/// by runtimes to run and identify subscriptions. You can use it to create your /// by runtimes to run and identify subscriptions. You can use it to create your
/// own! /// own!
/// ///
/// [`Subscription`]: struct.Subscription.html
/// [`Recipe`]: trait.Recipe.html
///
/// # Examples /// # Examples
/// The repository has a couple of [examples] that use a custom [`Recipe`]: /// The repository has a couple of [examples] that use a custom [`Recipe`]:
/// ///
@ -148,17 +131,11 @@ impl<I, O, H> std::fmt::Debug for Subscription<I, O, H> {
pub trait Recipe<Hasher: std::hash::Hasher, Event> { pub trait Recipe<Hasher: std::hash::Hasher, Event> {
/// The events that will be produced by a [`Subscription`] with this /// The events that will be produced by a [`Subscription`] with this
/// [`Recipe`]. /// [`Recipe`].
///
/// [`Subscription`]: struct.Subscription.html
/// [`Recipe`]: trait.Recipe.html
type Output; type Output;
/// Hashes the [`Recipe`]. /// Hashes the [`Recipe`].
/// ///
/// This is used by runtimes to uniquely identify a [`Subscription`]. /// This is used by runtimes to uniquely identify a [`Subscription`].
///
/// [`Subscription`]: struct.Subscription.html
/// [`Recipe`]: trait.Recipe.html
fn hash(&self, state: &mut Hasher); fn hash(&self, state: &mut Hasher);
/// Executes the [`Recipe`] and produces the stream of events of its /// Executes the [`Recipe`] and produces the stream of events of its
@ -166,9 +143,6 @@ pub trait Recipe<Hasher: std::hash::Hasher, Event> {
/// ///
/// It receives some stream of generic events, which is normally defined by /// It receives some stream of generic events, which is normally defined by
/// shells. /// shells.
///
/// [`Subscription`]: struct.Subscription.html
/// [`Recipe`]: trait.Recipe.html
fn stream( fn stream(
self: Box<Self>, self: Box<Self>,
input: BoxStream<Event>, input: BoxStream<Event>,

View File

@ -26,8 +26,6 @@ where
Event: 'static + Send + Clone, Event: 'static + Send + Clone,
{ {
/// Creates a new empty [`Tracker`]. /// Creates a new empty [`Tracker`].
///
/// [`Tracker`]: struct.Tracker.html
pub fn new() -> Self { pub fn new() -> Self {
Self { Self {
subscriptions: HashMap::new(), subscriptions: HashMap::new(),
@ -52,9 +50,7 @@ where
/// It returns a list of futures that need to be spawned to materialize /// It returns a list of futures that need to be spawned to materialize
/// the [`Tracker`] changes. /// the [`Tracker`] changes.
/// ///
/// [`Tracker`]: struct.Tracker.html /// [`Recipe`]: crate::subscription::Recipe
/// [`Subscription`]: struct.Subscription.html
/// [`Recipe`]: trait.Recipe.html
pub fn update<Message, Receiver>( pub fn update<Message, Receiver>(
&mut self, &mut self,
subscription: Subscription<Hasher, Event, Message>, subscription: Subscription<Hasher, Event, Message>,
@ -132,7 +128,7 @@ where
/// This method publishes the given event to all the subscription streams /// This method publishes the given event to all the subscription streams
/// currently open. /// currently open.
/// ///
/// [`Recipe::stream`]: trait.Recipe.html#tymethod.stream /// [`Recipe::stream`]: crate::subscription::Recipe::stream
pub fn broadcast(&mut self, event: Event) { pub fn broadcast(&mut self, event: Event) {
self.subscriptions self.subscriptions
.values_mut() .values_mut()

View File

@ -5,8 +5,6 @@ use crate::subscription::{self, Subscription};
/// ///
/// The first message is produced after a `duration`, and then continues to /// The first message is produced after a `duration`, and then continues to
/// produce more messages every `duration` after that. /// produce more messages every `duration` after that.
///
/// [`Subscription`]: ../subscription/struct.Subscription.html
pub fn every<H: std::hash::Hasher, E>( pub fn every<H: std::hash::Hasher, E>(
duration: std::time::Duration, duration: std::time::Duration,
) -> Subscription<H, E, std::time::Instant> { ) -> Subscription<H, E, std::time::Instant> {

View File

@ -23,8 +23,6 @@ pub struct Backend {
impl Backend { impl Backend {
/// Creates a new [`Backend`]. /// Creates a new [`Backend`].
///
/// [`Backend`]: struct.Backend.html
pub fn new(gl: &glow::Context, settings: Settings) -> Self { pub fn new(gl: &glow::Context, settings: Settings) -> Self {
let text_pipeline = text::Pipeline::new(gl, settings.default_font); let text_pipeline = text::Pipeline::new(gl, settings.default_font);
let quad_pipeline = quad::Pipeline::new(gl); let quad_pipeline = quad::Pipeline::new(gl);

View File

@ -1,9 +1,9 @@
//! Configure a renderer. //! Configure a renderer.
pub use iced_graphics::Antialiasing; pub use iced_graphics::Antialiasing;
/// The settings of a [`Renderer`]. /// The settings of a [`Backend`].
/// ///
/// [`Renderer`]: ../struct.Renderer.html /// [`Backend`]: crate::Backend
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Settings { pub struct Settings {
/// The bytes of the font that will be used by default. /// The bytes of the font that will be used by default.

View File

@ -1,9 +1,6 @@
//! Allow your users to perform actions by pressing a button. //! Allow your users to perform actions by pressing a button.
//! //!
//! A [`Button`] has some local [`State`]. //! A [`Button`] has some local [`State`].
//!
//! [`Button`]: type.Button.html
//! [`State`]: struct.State.html
use crate::Renderer; use crate::Renderer;
pub use iced_graphics::button::{Style, StyleSheet}; pub use iced_graphics::button::{Style, StyleSheet};

View File

@ -3,7 +3,4 @@
//! A [`Canvas`] widget can be used to draw different kinds of 2D shapes in a //! A [`Canvas`] widget can be used to draw different kinds of 2D shapes in a
//! [`Frame`]. It can be used for animation, data visualization, game graphics, //! [`Frame`]. It can be used for animation, data visualization, game graphics,
//! and more! //! and more!
//!
//! [`Canvas`]: struct.Canvas.html
//! [`Frame`]: struct.Frame.html
pub use iced_graphics::canvas::*; pub use iced_graphics::canvas::*;

View File

@ -7,7 +7,6 @@
//! drag and drop, and hotkey support. //! drag and drop, and hotkey support.
//! //!
//! [`pane_grid` example]: https://github.com/hecrj/iced/tree/0.1/examples/pane_grid //! [`pane_grid` example]: https://github.com/hecrj/iced/tree/0.1/examples/pane_grid
//! [`PaneGrid`]: type.PaneGrid.html
use crate::Renderer; use crate::Renderer;
pub use iced_native::pane_grid::{ pub use iced_native::pane_grid::{
@ -24,13 +23,9 @@ pub use iced_native::pane_grid::{
pub type PaneGrid<'a, Message> = iced_native::PaneGrid<'a, Message, Renderer>; pub type PaneGrid<'a, Message> = iced_native::PaneGrid<'a, Message, Renderer>;
/// The content of a [`Pane`]. /// The content of a [`Pane`].
///
/// [`Pane`]: struct.Pane.html
pub type Content<'a, Message> = pub type Content<'a, Message> =
iced_native::pane_grid::Content<'a, Message, Renderer>; iced_native::pane_grid::Content<'a, Message, Renderer>;
/// The title bar of a [`Pane`]. /// The title bar of a [`Pane`].
///
/// [`Pane`]: struct.Pane.html
pub type TitleBar<'a, Message> = pub type TitleBar<'a, Message> =
iced_native::pane_grid::TitleBar<'a, Message, Renderer>; iced_native::pane_grid::TitleBar<'a, Message, Renderer>;

View File

@ -2,8 +2,6 @@
//! //!
//! A [`ProgressBar`] has a range of possible values and a current value, //! A [`ProgressBar`] has a range of possible values and a current value,
//! as well as a length, height and style. //! as well as a length, height and style.
//!
//! [`ProgressBar`]: type.ProgressBar.html
use crate::Renderer; use crate::Renderer;
pub use iced_graphics::progress_bar::{Style, StyleSheet}; pub use iced_graphics::progress_bar::{Style, StyleSheet};

View File

@ -1,9 +1,6 @@
//! Display an interactive selector of a single value from a range of values. //! Display an interactive selector of a single value from a range of values.
//! //!
//! A [`Slider`] has some local [`State`]. //! A [`Slider`] has some local [`State`].
//!
//! [`Slider`]: struct.Slider.html
//! [`State`]: struct.State.html
use crate::Renderer; use crate::Renderer;
pub use iced_graphics::slider::{Handle, HandleShape, Style, StyleSheet}; pub use iced_graphics::slider::{Handle, HandleShape, Style, StyleSheet};

View File

@ -1,9 +1,6 @@
//! Display fields that can be filled with text. //! Display fields that can be filled with text.
//! //!
//! A [`TextInput`] has some local [`State`]. //! A [`TextInput`] has some local [`State`].
//!
//! [`TextInput`]: struct.TextInput.html
//! [`State`]: struct.State.html
use crate::Renderer; use crate::Renderer;
pub use iced_graphics::text_input::{Style, StyleSheet}; pub use iced_graphics::text_input::{Style, StyleSheet};

View File

@ -15,8 +15,6 @@ use std::mem::ManuallyDrop;
/// Runs an [`Application`] with an executor, compositor, and the provided /// Runs an [`Application`] with an executor, compositor, and the provided
/// settings. /// settings.
///
/// [`Application`]: trait.Application.html
pub fn run<A, E, C>( pub fn run<A, E, C>(
settings: Settings<A::Flags>, settings: Settings<A::Flags>,
compositor_settings: C::Settings, compositor_settings: C::Settings,

View File

@ -13,8 +13,6 @@ pub enum Antialiasing {
impl Antialiasing { impl Antialiasing {
/// Returns the amount of samples of the [`Antialiasing`]. /// Returns the amount of samples of the [`Antialiasing`].
///
/// [`Antialiasing`]: enum.Antialiasing.html
pub fn sample_count(self) -> u32 { pub fn sample_count(self) -> u32 {
match self { match self {
Antialiasing::MSAAx2 => 2, Antialiasing::MSAAx2 => 2,

View File

@ -5,7 +5,7 @@ use iced_native::{Font, Size};
/// The graphics backend of a [`Renderer`]. /// The graphics backend of a [`Renderer`].
/// ///
/// [`Renderer`]: ../struct.Renderer.html /// [`Renderer`]: crate::Renderer
pub trait Backend { pub trait Backend {
/// Trims the measurements cache. /// Trims the measurements cache.
/// ///

View File

@ -26,14 +26,10 @@ pub const ICONS: iced_native::Font = iced_native::Font::External {
}; };
/// The `char` representing a ✔ icon in the built-in [`ICONS`] font. /// The `char` representing a ✔ icon in the built-in [`ICONS`] font.
///
/// [`ICONS`]: const.ICONS.html
#[cfg(feature = "font-icons")] #[cfg(feature = "font-icons")]
#[cfg_attr(docsrs, doc(cfg(feature = "font-icons")))] #[cfg_attr(docsrs, doc(cfg(feature = "font-icons")))]
pub const CHECKMARK_ICON: char = '\u{F00C}'; pub const CHECKMARK_ICON: char = '\u{F00C}';
/// The `char` representing a ▼ icon in the built-in [`ICONS`] font. /// The `char` representing a ▼ icon in the built-in [`ICONS`] font.
///
/// [`ICONS`]: const.ICONS.html
#[cfg(feature = "font-icons")] #[cfg(feature = "font-icons")]
pub const ARROW_DOWN_ICON: char = '\u{E800}'; pub const ARROW_DOWN_ICON: char = '\u{E800}';

View File

@ -8,8 +8,6 @@ pub struct Source {
impl Source { impl Source {
/// Creates a new [`Source`]. /// Creates a new [`Source`].
///
/// [`Source`]: struct.Source.html
pub fn new() -> Self { pub fn new() -> Self {
Source { Source {
raw: font_kit::source::SystemSource::new(), raw: font_kit::source::SystemSource::new(),
@ -17,8 +15,6 @@ impl Source {
} }
/// Finds and loads a font matching the set of provided family priorities. /// Finds and loads a font matching the set of provided family priorities.
///
/// [`Source`]: struct.Source.html
pub fn load(&self, families: &[Family]) -> Result<Vec<u8>, LoadError> { pub fn load(&self, families: &[Family]) -> Result<Vec<u8>, LoadError> {
let font = self.raw.select_best_match( let font = self.raw.select_best_match(
families, families,

View File

@ -11,35 +11,23 @@ use crate::{
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Layer<'a> { pub struct Layer<'a> {
/// The clipping bounds of the [`Layer`]. /// The clipping bounds of the [`Layer`].
///
/// [`Layer`]: struct.Layer.html
pub bounds: Rectangle, pub bounds: Rectangle,
/// The quads of the [`Layer`]. /// The quads of the [`Layer`].
///
/// [`Layer`]: struct.Layer.html
pub quads: Vec<Quad>, pub quads: Vec<Quad>,
/// The triangle meshes of the [`Layer`]. /// The triangle meshes of the [`Layer`].
///
/// [`Layer`]: struct.Layer.html
pub meshes: Vec<Mesh<'a>>, pub meshes: Vec<Mesh<'a>>,
/// The text of the [`Layer`]. /// The text of the [`Layer`].
///
/// [`Layer`]: struct.Layer.html
pub text: Vec<Text<'a>>, pub text: Vec<Text<'a>>,
/// The images of the [`Layer`]. /// The images of the [`Layer`].
///
/// [`Layer`]: struct.Layer.html
pub images: Vec<Image>, pub images: Vec<Image>,
} }
impl<'a> Layer<'a> { impl<'a> Layer<'a> {
/// Creates a new [`Layer`] with the given clipping bounds. /// Creates a new [`Layer`] with the given clipping bounds.
///
/// [`Layer`]: struct.Layer.html
pub fn new(bounds: Rectangle) -> Self { pub fn new(bounds: Rectangle) -> Self {
Self { Self {
bounds, bounds,
@ -53,8 +41,6 @@ impl<'a> Layer<'a> {
/// Creates a new [`Layer`] for the provided overlay text. /// Creates a new [`Layer`] for the provided overlay text.
/// ///
/// This can be useful for displaying debug information. /// This can be useful for displaying debug information.
///
/// [`Layer`]: struct.Layer.html
pub fn overlay(lines: &'a [impl AsRef<str>], viewport: &Viewport) -> Self { pub fn overlay(lines: &'a [impl AsRef<str>], viewport: &Viewport) -> Self {
let mut overlay = let mut overlay =
Layer::new(Rectangle::with_size(viewport.logical_size())); Layer::new(Rectangle::with_size(viewport.logical_size()));
@ -87,8 +73,6 @@ impl<'a> Layer<'a> {
/// Distributes the given [`Primitive`] and generates a list of layers based /// Distributes the given [`Primitive`] and generates a list of layers based
/// on its contents. /// on its contents.
///
/// [`Primitive`]: ../enum.Primitive.html
pub fn generate( pub fn generate(
primitive: &'a Primitive, primitive: &'a Primitive,
viewport: &Viewport, viewport: &Viewport,
@ -243,33 +227,21 @@ impl<'a> Layer<'a> {
#[repr(C)] #[repr(C)]
pub struct Quad { pub struct Quad {
/// The position of the [`Quad`]. /// The position of the [`Quad`].
///
/// [`Quad`]: struct.Quad.html
pub position: [f32; 2], pub position: [f32; 2],
/// The size of the [`Quad`]. /// The size of the [`Quad`].
///
/// [`Quad`]: struct.Quad.html
pub size: [f32; 2], pub size: [f32; 2],
/// The color of the [`Quad`], in __linear RGB__. /// The color of the [`Quad`], in __linear RGB__.
///
/// [`Quad`]: struct.Quad.html
pub color: [f32; 4], pub color: [f32; 4],
/// The border color of the [`Quad`], in __linear RGB__. /// The border color of the [`Quad`], in __linear RGB__.
///
/// [`Quad`]: struct.Quad.html
pub border_color: [f32; 4], pub border_color: [f32; 4],
/// The border radius of the [`Quad`]. /// The border radius of the [`Quad`].
///
/// [`Quad`]: struct.Quad.html
pub border_radius: f32, pub border_radius: f32,
/// The border width of the [`Quad`]. /// The border width of the [`Quad`].
///
/// [`Quad`]: struct.Quad.html
pub border_width: f32, pub border_width: f32,
} }
@ -277,18 +249,12 @@ pub struct Quad {
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub struct Mesh<'a> { pub struct Mesh<'a> {
/// The origin of the vertices of the [`Mesh`]. /// The origin of the vertices of the [`Mesh`].
///
/// [`Mesh`]: struct.Mesh.html
pub origin: Point, pub origin: Point,
/// The vertex and index buffers of the [`Mesh`]. /// The vertex and index buffers of the [`Mesh`].
///
/// [`Mesh`]: struct.Mesh.html
pub buffers: &'a triangle::Mesh2D, pub buffers: &'a triangle::Mesh2D,
/// The clipping bounds of the [`Mesh`]. /// The clipping bounds of the [`Mesh`].
///
/// [`Mesh`]: struct.Mesh.html
pub clip_bounds: Rectangle<f32>, pub clip_bounds: Rectangle<f32>,
} }
@ -296,38 +262,24 @@ pub struct Mesh<'a> {
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub struct Text<'a> { pub struct Text<'a> {
/// The content of the [`Text`]. /// The content of the [`Text`].
///
/// [`Text`]: struct.Text.html
pub content: &'a str, pub content: &'a str,
/// The layout bounds of the [`Text`]. /// The layout bounds of the [`Text`].
///
/// [`Text`]: struct.Text.html
pub bounds: Rectangle, pub bounds: Rectangle,
/// The color of the [`Text`], in __linear RGB_. /// The color of the [`Text`], in __linear RGB_.
///
/// [`Text`]: struct.Text.html
pub color: [f32; 4], pub color: [f32; 4],
/// The size of the [`Text`]. /// The size of the [`Text`].
///
/// [`Text`]: struct.Text.html
pub size: f32, pub size: f32,
/// The font of the [`Text`]. /// The font of the [`Text`].
///
/// [`Text`]: struct.Text.html
pub font: Font, pub font: Font,
/// The horizontal alignment of the [`Text`]. /// The horizontal alignment of the [`Text`].
///
/// [`Text`]: struct.Text.html
pub horizontal_alignment: HorizontalAlignment, pub horizontal_alignment: HorizontalAlignment,
/// The vertical alignment of the [`Text`]. /// The vertical alignment of the [`Text`].
///
/// [`Text`]: struct.Text.html
pub vertical_alignment: VerticalAlignment, pub vertical_alignment: VerticalAlignment,
} }

View File

@ -13,25 +13,16 @@ pub struct Renderer<B: Backend> {
impl<B: Backend> Renderer<B> { impl<B: Backend> Renderer<B> {
/// Creates a new [`Renderer`] from the given [`Backend`]. /// Creates a new [`Renderer`] from the given [`Backend`].
///
/// [`Renderer`]: struct.Renderer.html
/// [`Backend`]: backend/trait.Backend.html
pub fn new(backend: B) -> Self { pub fn new(backend: B) -> Self {
Self { backend } Self { backend }
} }
/// Returns a reference to the [`Backend`] of the [`Renderer`]. /// Returns a reference to the [`Backend`] of the [`Renderer`].
///
/// [`Renderer`]: struct.Renderer.html
/// [`Backend`]: backend/trait.Backend.html
pub fn backend(&self) -> &B { pub fn backend(&self) -> &B {
&self.backend &self.backend
} }
/// Returns a mutable reference to the [`Backend`] of the [`Renderer`]. /// Returns a mutable reference to the [`Backend`] of the [`Renderer`].
///
/// [`Renderer`]: struct.Renderer.html
/// [`Backend`]: backend/trait.Backend.html
pub fn backend_mut(&mut self) -> &mut B { pub fn backend_mut(&mut self) -> &mut B {
&mut self.backend &mut self.backend
} }

View File

@ -2,8 +2,6 @@
use bytemuck::{Pod, Zeroable}; use bytemuck::{Pod, Zeroable};
/// A set of [`Vertex2D`] and indices representing a list of triangles. /// A set of [`Vertex2D`] and indices representing a list of triangles.
///
/// [`Vertex2D`]: struct.Vertex2D.html
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Mesh2D { pub struct Mesh2D {
/// The vertices of the mesh /// The vertices of the mesh

View File

@ -12,8 +12,6 @@ pub struct Viewport {
impl Viewport { impl Viewport {
/// Creates a new [`Viewport`] with the given physical dimensions and scale /// Creates a new [`Viewport`] with the given physical dimensions and scale
/// factor. /// factor.
///
/// [`Viewport`]: struct.Viewport.html
pub fn with_physical_size(size: Size<u32>, scale_factor: f64) -> Viewport { pub fn with_physical_size(size: Size<u32>, scale_factor: f64) -> Viewport {
Viewport { Viewport {
physical_size: size, physical_size: size,
@ -27,43 +25,31 @@ impl Viewport {
} }
/// Returns the physical size of the [`Viewport`]. /// Returns the physical size of the [`Viewport`].
///
/// [`Viewport`]: struct.Viewport.html
pub fn physical_size(&self) -> Size<u32> { pub fn physical_size(&self) -> Size<u32> {
self.physical_size self.physical_size
} }
/// Returns the physical width of the [`Viewport`]. /// Returns the physical width of the [`Viewport`].
///
/// [`Viewport`]: struct.Viewport.html
pub fn physical_width(&self) -> u32 { pub fn physical_width(&self) -> u32 {
self.physical_size.height self.physical_size.height
} }
/// Returns the physical height of the [`Viewport`]. /// Returns the physical height of the [`Viewport`].
///
/// [`Viewport`]: struct.Viewport.html
pub fn physical_height(&self) -> u32 { pub fn physical_height(&self) -> u32 {
self.physical_size.height self.physical_size.height
} }
/// Returns the logical size of the [`Viewport`]. /// Returns the logical size of the [`Viewport`].
///
/// [`Viewport`]: struct.Viewport.html
pub fn logical_size(&self) -> Size<f32> { pub fn logical_size(&self) -> Size<f32> {
self.logical_size self.logical_size
} }
/// Returns the scale factor of the [`Viewport`]. /// Returns the scale factor of the [`Viewport`].
///
/// [`Viewport`]: struct.Viewport.html
pub fn scale_factor(&self) -> f64 { pub fn scale_factor(&self) -> f64 {
self.scale_factor self.scale_factor
} }
/// Returns the projection transformation of the [`Viewport`]. /// Returns the projection transformation of the [`Viewport`].
///
/// [`Viewport`]: struct.Viewport.html
pub fn projection(&self) -> Transformation { pub fn projection(&self) -> Transformation {
self.projection self.projection
} }

View File

@ -1,9 +1,6 @@
//! Allow your users to perform actions by pressing a button. //! Allow your users to perform actions by pressing a button.
//! //!
//! A [`Button`] has some local [`State`]. //! A [`Button`] has some local [`State`].
//!
//! [`Button`]: type.Button.html
//! [`State`]: struct.State.html
use crate::defaults::{self, Defaults}; use crate::defaults::{self, Defaults};
use crate::{Backend, Primitive, Renderer}; use crate::{Backend, Primitive, Renderer};
use iced_native::mouse; use iced_native::mouse;

View File

@ -3,9 +3,6 @@
//! A [`Canvas`] widget can be used to draw different kinds of 2D shapes in a //! A [`Canvas`] widget can be used to draw different kinds of 2D shapes in a
//! [`Frame`]. It can be used for animation, data visualization, game graphics, //! [`Frame`]. It can be used for animation, data visualization, game graphics,
//! and more! //! and more!
//!
//! [`Canvas`]: struct.Canvas.html
//! [`Frame`]: struct.Frame.html
use crate::{Backend, Defaults, Primitive, Renderer}; use crate::{Backend, Defaults, Primitive, Renderer};
use iced_native::layout; use iced_native::layout;
use iced_native::mouse; use iced_native::mouse;
@ -41,8 +38,6 @@ pub use text::Text;
/// A widget capable of drawing 2D graphics. /// A widget capable of drawing 2D graphics.
/// ///
/// [`Canvas`]: struct.Canvas.html
///
/// # Examples /// # Examples
/// The repository has a couple of [examples] showcasing how to use a /// The repository has a couple of [examples] showcasing how to use a
/// [`Canvas`]: /// [`Canvas`]:
@ -108,8 +103,6 @@ impl<Message, P: Program<Message>> Canvas<Message, P> {
const DEFAULT_SIZE: u16 = 100; const DEFAULT_SIZE: u16 = 100;
/// Creates a new [`Canvas`]. /// Creates a new [`Canvas`].
///
/// [`Canvas`]: struct.Canvas.html
pub fn new(program: P) -> Self { pub fn new(program: P) -> Self {
Canvas { Canvas {
width: Length::Units(Self::DEFAULT_SIZE), width: Length::Units(Self::DEFAULT_SIZE),
@ -120,16 +113,12 @@ impl<Message, P: Program<Message>> Canvas<Message, P> {
} }
/// Sets the width of the [`Canvas`]. /// Sets the width of the [`Canvas`].
///
/// [`Canvas`]: struct.Canvas.html
pub fn width(mut self, width: Length) -> Self { pub fn width(mut self, width: Length) -> Self {
self.width = width; self.width = width;
self self
} }
/// Sets the height of the [`Canvas`]. /// Sets the height of the [`Canvas`].
///
/// [`Canvas`]: struct.Canvas.html
pub fn height(mut self, height: Length) -> Self { pub fn height(mut self, height: Length) -> Self {
self.height = height; self.height = height;
self self

View File

@ -23,10 +23,6 @@ impl Default for State {
/// ///
/// A [`Cache`] will not redraw its geometry unless the dimensions of its layer /// A [`Cache`] will not redraw its geometry unless the dimensions of its layer
/// change or it is explicitly cleared. /// change or it is explicitly cleared.
///
/// [`Layer`]: ../trait.Layer.html
/// [`Cache`]: struct.Cache.html
/// [`Geometry`]: struct.Geometry.html
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub struct Cache { pub struct Cache {
state: RefCell<State>, state: RefCell<State>,
@ -34,8 +30,6 @@ pub struct Cache {
impl Cache { impl Cache {
/// Creates a new empty [`Cache`]. /// Creates a new empty [`Cache`].
///
/// [`Cache`]: struct.Cache.html
pub fn new() -> Self { pub fn new() -> Self {
Cache { Cache {
state: Default::default(), state: Default::default(),
@ -43,8 +37,6 @@ impl Cache {
} }
/// Clears the [`Cache`], forcing a redraw the next time it is used. /// Clears the [`Cache`], forcing a redraw the next time it is used.
///
/// [`Cache`]: struct.Cache.html
pub fn clear(&mut self) { pub fn clear(&mut self) {
*self.state.borrow_mut() = State::Empty; *self.state.borrow_mut() = State::Empty;
} }
@ -59,8 +51,6 @@ impl Cache {
/// Otherwise, the previously stored [`Geometry`] will be returned. The /// Otherwise, the previously stored [`Geometry`] will be returned. The
/// [`Cache`] is not cleared in this case. In other words, it will keep /// [`Cache`] is not cleared in this case. In other words, it will keep
/// returning the stored [`Geometry`] if needed. /// returning the stored [`Geometry`] if needed.
///
/// [`Cache`]: struct.Cache.html
pub fn draw(&self, bounds: Size, draw_fn: impl Fn(&mut Frame)) -> Geometry { pub fn draw(&self, bounds: Size, draw_fn: impl Fn(&mut Frame)) -> Geometry {
use std::ops::Deref; use std::ops::Deref;

View File

@ -22,8 +22,6 @@ impl Cursor {
} }
/// Returns the absolute position of the [`Cursor`], if available. /// Returns the absolute position of the [`Cursor`], if available.
///
/// [`Cursor`]: enum.Cursor.html
pub fn position(&self) -> Option<Point> { pub fn position(&self) -> Option<Point> {
match self { match self {
Cursor::Available(position) => Some(*position), Cursor::Available(position) => Some(*position),
@ -36,8 +34,6 @@ impl Cursor {
/// ///
/// If the [`Cursor`] is not over the provided bounds, this method will /// If the [`Cursor`] is not over the provided bounds, this method will
/// return `None`. /// return `None`.
///
/// [`Cursor`]: enum.Cursor.html
pub fn position_in(&self, bounds: &Rectangle) -> Option<Point> { pub fn position_in(&self, bounds: &Rectangle) -> Option<Point> {
if self.is_over(bounds) { if self.is_over(bounds) {
self.position_from(bounds.position()) self.position_from(bounds.position())
@ -48,8 +44,6 @@ impl Cursor {
/// Returns the relative position of the [`Cursor`] from the given origin, /// Returns the relative position of the [`Cursor`] from the given origin,
/// if available. /// if available.
///
/// [`Cursor`]: enum.Cursor.html
pub fn position_from(&self, origin: Point) -> Option<Point> { pub fn position_from(&self, origin: Point) -> Option<Point> {
match self { match self {
Cursor::Available(position) => { Cursor::Available(position) => {
@ -61,8 +55,6 @@ impl Cursor {
/// Returns whether the [`Cursor`] is currently over the provided bounds /// Returns whether the [`Cursor`] is currently over the provided bounds
/// or not. /// or not.
///
/// [`Cursor`]: enum.Cursor.html
pub fn is_over(&self, bounds: &Rectangle) -> bool { pub fn is_over(&self, bounds: &Rectangle) -> bool {
match self { match self {
Cursor::Available(position) => bounds.contains(*position), Cursor::Available(position) => bounds.contains(*position),

View File

@ -6,7 +6,7 @@ pub use iced_native::event::Status;
/// A [`Canvas`] event. /// A [`Canvas`] event.
/// ///
/// [`Canvas`]: struct.Event.html /// [`Canvas`]: crate::widget::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

@ -7,7 +7,7 @@ use crate::{
/// The frame of a [`Canvas`]. /// The frame of a [`Canvas`].
/// ///
/// [`Canvas`]: struct.Canvas.html /// [`Canvas`]: crate::widget::Canvas
#[derive(Debug)] #[derive(Debug)]
pub struct Frame { pub struct Frame {
size: Size, size: Size,
@ -33,8 +33,6 @@ impl Frame {
/// ///
/// The default coordinate system of a [`Frame`] has its origin at the /// The default coordinate system of a [`Frame`] has its origin at the
/// top-left corner of its bounds. /// top-left corner of its bounds.
///
/// [`Frame`]: struct.Frame.html
pub fn new(size: Size) -> Frame { pub fn new(size: Size) -> Frame {
Frame { Frame {
size, size,
@ -51,32 +49,24 @@ impl Frame {
} }
/// Returns the width of the [`Frame`]. /// Returns the width of the [`Frame`].
///
/// [`Frame`]: struct.Frame.html
#[inline] #[inline]
pub fn width(&self) -> f32 { pub fn width(&self) -> f32 {
self.size.width self.size.width
} }
/// Returns the width of the [`Frame`]. /// Returns the width of the [`Frame`].
///
/// [`Frame`]: struct.Frame.html
#[inline] #[inline]
pub fn height(&self) -> f32 { pub fn height(&self) -> f32 {
self.size.height self.size.height
} }
/// Returns the dimensions of the [`Frame`]. /// Returns the dimensions of the [`Frame`].
///
/// [`Frame`]: struct.Frame.html
#[inline] #[inline]
pub fn size(&self) -> Size { pub fn size(&self) -> Size {
self.size self.size
} }
/// Returns the coordinate of the center of the [`Frame`]. /// Returns the coordinate of the center of the [`Frame`].
///
/// [`Frame`]: struct.Frame.html
#[inline] #[inline]
pub fn center(&self) -> Point { pub fn center(&self) -> Point {
Point::new(self.size.width / 2.0, self.size.height / 2.0) Point::new(self.size.width / 2.0, self.size.height / 2.0)
@ -84,9 +74,6 @@ impl Frame {
/// Draws the given [`Path`] on the [`Frame`] by filling it with the /// Draws the given [`Path`] on the [`Frame`] by filling it with the
/// provided style. /// provided style.
///
/// [`Path`]: path/struct.Path.html
/// [`Frame`]: struct.Frame.html
pub fn fill(&mut self, path: &Path, fill: impl Into<Fill>) { pub fn fill(&mut self, path: &Path, fill: impl Into<Fill>) {
use lyon::tessellation::{ use lyon::tessellation::{
BuffersBuilder, FillOptions, FillTessellator, BuffersBuilder, FillOptions, FillTessellator,
@ -115,8 +102,6 @@ impl Frame {
/// Draws an axis-aligned rectangle given its top-left corner coordinate and /// Draws an axis-aligned rectangle given its top-left corner coordinate and
/// its `Size` on the [`Frame`] by filling it with the provided style. /// its `Size` on the [`Frame`] by filling it with the provided style.
///
/// [`Frame`]: struct.Frame.html
pub fn fill_rectangle( pub fn fill_rectangle(
&mut self, &mut self,
top_left: Point, top_left: Point,
@ -152,9 +137,6 @@ impl Frame {
/// Draws the stroke of the given [`Path`] on the [`Frame`] with the /// Draws the stroke of the given [`Path`] on the [`Frame`] with the
/// provided style. /// provided style.
///
/// [`Path`]: path/struct.Path.html
/// [`Frame`]: struct.Frame.html
pub fn stroke(&mut self, path: &Path, stroke: impl Into<Stroke>) { pub fn stroke(&mut self, path: &Path, stroke: impl Into<Stroke>) {
use lyon::tessellation::{ use lyon::tessellation::{
BuffersBuilder, StrokeOptions, StrokeTessellator, BuffersBuilder, StrokeOptions, StrokeTessellator,
@ -200,9 +182,7 @@ impl Frame {
/// Support for vectorial text is planned, and should address all these /// Support for vectorial text is planned, and should address all these
/// limitations. /// limitations.
/// ///
/// [`Text`]: struct.Text.html /// [`Canvas`]: crate::widget::Canvas
/// [`Frame`]: struct.Frame.html
/// [`Canvas`]: struct.Canvas.html
pub fn fill_text(&mut self, text: impl Into<Text>) { pub fn fill_text(&mut self, text: impl Into<Text>) {
use std::f32; use std::f32;
@ -240,8 +220,6 @@ impl Frame {
/// ///
/// This method is useful to compose transforms and perform drawing /// This method is useful to compose transforms and perform drawing
/// operations in different coordinate systems. /// operations in different coordinate systems.
///
/// [`Frame`]: struct.Frame.html
#[inline] #[inline]
pub fn with_save(&mut self, f: impl FnOnce(&mut Frame)) { pub fn with_save(&mut self, f: impl FnOnce(&mut Frame)) {
self.transforms.previous.push(self.transforms.current); self.transforms.previous.push(self.transforms.current);
@ -252,8 +230,6 @@ impl Frame {
} }
/// Applies a translation to the current transform of the [`Frame`]. /// Applies a translation to the current transform of the [`Frame`].
///
/// [`Frame`]: struct.Frame.html
#[inline] #[inline]
pub fn translate(&mut self, translation: Vector) { pub fn translate(&mut self, translation: Vector) {
self.transforms.current.raw = self self.transforms.current.raw = self
@ -268,8 +244,6 @@ impl Frame {
} }
/// Applies a rotation to the current transform of the [`Frame`]. /// Applies a rotation to the current transform of the [`Frame`].
///
/// [`Frame`]: struct.Frame.html
#[inline] #[inline]
pub fn rotate(&mut self, angle: f32) { pub fn rotate(&mut self, angle: f32) {
self.transforms.current.raw = self self.transforms.current.raw = self
@ -281,8 +255,6 @@ impl Frame {
} }
/// Applies a scaling to the current transform of the [`Frame`]. /// Applies a scaling to the current transform of the [`Frame`].
///
/// [`Frame`]: struct.Frame.html
#[inline] #[inline]
pub fn scale(&mut self, scale: f32) { pub fn scale(&mut self, scale: f32) {
self.transforms.current.raw = self.transforms.current.raw =
@ -291,9 +263,6 @@ impl Frame {
} }
/// Produces the [`Geometry`] representing everything drawn on the [`Frame`]. /// Produces the [`Geometry`] representing everything drawn on the [`Frame`].
///
/// [`Frame`]: struct.Frame.html
/// [`Geometry`]: struct.Geometry.html
pub fn into_geometry(mut self) -> Geometry { pub fn into_geometry(mut self) -> Geometry {
if !self.buffers.indices.is_empty() { if !self.buffers.indices.is_empty() {
self.primitives.push(Primitive::Mesh2D { self.primitives.push(Primitive::Mesh2D {

View File

@ -5,9 +5,8 @@ use crate::Primitive;
/// [`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`].
/// ///
/// [`Geometry`]: struct.Geometry.html /// [`Frame`]: crate::widget::canvas::Frame
/// [`Frame`]: struct.Frame.html /// [`Cache`]: crate::widget::canvas::Cache
/// [`Cache`]: struct.Cache.html
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Geometry(Primitive); pub struct Geometry(Primitive);
@ -19,9 +18,6 @@ impl Geometry {
/// Turns the [`Geometry`] into a [`Primitive`]. /// Turns the [`Geometry`] into a [`Primitive`].
/// ///
/// This can be useful if you are building a custom widget. /// This can be useful if you are building a custom widget.
///
/// [`Geometry`]: struct.Geometry.html
/// [`Primitive`]: ../enum.Primitive.html
pub fn into_primitive(self) -> Primitive { pub fn into_primitive(self) -> Primitive {
self.0 self.0
} }

View File

@ -12,8 +12,6 @@ use iced_native::{Point, Size};
/// An immutable set of points that may or may not be connected. /// An immutable set of points that may or may not be connected.
/// ///
/// A single [`Path`] can represent different kinds of 2D shapes! /// A single [`Path`] can represent different kinds of 2D shapes!
///
/// [`Path`]: struct.Path.html
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Path { pub struct Path {
raw: lyon::path::Path, raw: lyon::path::Path,
@ -23,9 +21,6 @@ impl Path {
/// Creates a new [`Path`] with the provided closure. /// Creates a new [`Path`] with the provided closure.
/// ///
/// Use the [`Builder`] to configure your [`Path`]. /// Use the [`Builder`] to configure your [`Path`].
///
/// [`Path`]: struct.Path.html
/// [`Builder`]: struct.Builder.html
pub fn new(f: impl FnOnce(&mut Builder)) -> Self { pub fn new(f: impl FnOnce(&mut Builder)) -> Self {
let mut builder = Builder::new(); let mut builder = Builder::new();
@ -37,8 +32,6 @@ impl Path {
/// Creates a new [`Path`] representing a line segment given its starting /// Creates a new [`Path`] representing a line segment given its starting
/// and end points. /// and end points.
///
/// [`Path`]: struct.Path.html
pub fn line(from: Point, to: Point) -> Self { pub fn line(from: Point, to: Point) -> Self {
Self::new(|p| { Self::new(|p| {
p.move_to(from); p.move_to(from);
@ -48,16 +41,12 @@ impl Path {
/// Creates a new [`Path`] representing a rectangle given its top-left /// Creates a new [`Path`] representing a rectangle given its top-left
/// corner coordinate and its `Size`. /// corner coordinate and its `Size`.
///
/// [`Path`]: struct.Path.html
pub fn rectangle(top_left: Point, size: Size) -> Self { pub fn rectangle(top_left: Point, size: Size) -> Self {
Self::new(|p| p.rectangle(top_left, size)) Self::new(|p| p.rectangle(top_left, size))
} }
/// Creates a new [`Path`] representing a circle given its center /// Creates a new [`Path`] representing a circle given its center
/// coordinate and its radius. /// coordinate and its radius.
///
/// [`Path`]: struct.Path.html
pub fn circle(center: Point, radius: f32) -> Self { pub fn circle(center: Point, radius: f32) -> Self {
Self::new(|p| p.circle(center, radius)) Self::new(|p| p.circle(center, radius))
} }

View File

@ -15,8 +15,6 @@ pub struct Arc {
} }
/// An elliptical [`Arc`]. /// An elliptical [`Arc`].
///
/// [`Arc`]: struct.Arc.html
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub struct Elliptical { pub struct Elliptical {
/// The center of the arc. /// The center of the arc.

View File

@ -6,8 +6,6 @@ use lyon::path::builder::{Build, FlatPathBuilder, PathBuilder, SvgBuilder};
/// A [`Path`] builder. /// A [`Path`] builder.
/// ///
/// Once a [`Path`] is built, it can no longer be mutated. /// Once a [`Path`] is built, it can no longer be mutated.
///
/// [`Path`]: struct.Path.html
#[allow(missing_debug_implementations)] #[allow(missing_debug_implementations)]
pub struct Builder { pub struct Builder {
raw: lyon::path::builder::SvgPathBuilder<lyon::path::Builder>, raw: lyon::path::builder::SvgPathBuilder<lyon::path::Builder>,
@ -15,8 +13,6 @@ pub struct Builder {
impl Builder { impl Builder {
/// Creates a new [`Builder`]. /// Creates a new [`Builder`].
///
/// [`Builder`]: struct.Builder.html
pub fn new() -> Builder { pub fn new() -> Builder {
Builder { Builder {
raw: lyon::path::Path::builder().with_svg(), raw: lyon::path::Path::builder().with_svg(),
@ -31,8 +27,6 @@ impl Builder {
/// Connects the last point in the [`Path`] to the given `Point` with a /// Connects the last point in the [`Path`] to the given `Point` with a
/// straight line. /// straight line.
///
/// [`Path`]: struct.Path.html
#[inline] #[inline]
pub fn line_to(&mut self, point: Point) { pub fn line_to(&mut self, point: Point) {
let _ = self.raw.line_to(lyon::math::Point::new(point.x, point.y)); let _ = self.raw.line_to(lyon::math::Point::new(point.x, point.y));
@ -40,9 +34,6 @@ impl Builder {
/// Adds an [`Arc`] to the [`Path`] from `start_angle` to `end_angle` in /// Adds an [`Arc`] to the [`Path`] from `start_angle` to `end_angle` in
/// a clockwise direction. /// a clockwise direction.
///
/// [`Arc`]: struct.Arc.html
/// [`Path`]: struct.Path.html
#[inline] #[inline]
pub fn arc(&mut self, arc: Arc) { pub fn arc(&mut self, arc: Arc) {
self.ellipse(arc.into()); self.ellipse(arc.into());
@ -53,8 +44,6 @@ impl Builder {
/// ///
/// The arc is connected to the previous point by a straight line, if /// The arc is connected to the previous point by a straight line, if
/// necessary. /// necessary.
///
/// [`Path`]: struct.Path.html
pub fn arc_to(&mut self, a: Point, b: Point, radius: f32) { pub fn arc_to(&mut self, a: Point, b: Point, radius: f32) {
use lyon::{math, path}; use lyon::{math, path};
@ -72,10 +61,7 @@ impl Builder {
); );
} }
/// Adds an [`Ellipse`] to the [`Path`] using a clockwise direction. /// Adds an ellipse to the [`Path`] using a clockwise direction.
///
/// [`Ellipse`]: struct.Arc.html
/// [`Path`]: struct.Path.html
pub fn ellipse(&mut self, arc: arc::Elliptical) { pub fn ellipse(&mut self, arc: arc::Elliptical) {
use lyon::{geom, math}; use lyon::{geom, math};
@ -96,8 +82,6 @@ impl Builder {
/// Adds a cubic Bézier curve to the [`Path`] given its two control points /// Adds a cubic Bézier curve to the [`Path`] given its two control points
/// and its end point. /// and its end point.
///
/// [`Path`]: struct.Path.html
#[inline] #[inline]
pub fn bezier_curve_to( pub fn bezier_curve_to(
&mut self, &mut self,
@ -116,8 +100,6 @@ impl Builder {
/// Adds a quadratic Bézier curve to the [`Path`] given its control point /// Adds a quadratic Bézier curve to the [`Path`] given its control point
/// and its end point. /// and its end point.
///
/// [`Path`]: struct.Path.html
#[inline] #[inline]
pub fn quadratic_curve_to(&mut self, control: Point, to: Point) { pub fn quadratic_curve_to(&mut self, control: Point, to: Point) {
use lyon::math; use lyon::math;
@ -130,8 +112,6 @@ impl Builder {
/// Adds a rectangle to the [`Path`] given its top-left corner coordinate /// Adds a rectangle to the [`Path`] given its top-left corner coordinate
/// and its `Size`. /// and its `Size`.
///
/// [`Path`]: struct.Path.html
#[inline] #[inline]
pub fn rectangle(&mut self, top_left: Point, size: Size) { pub fn rectangle(&mut self, top_left: Point, size: Size) {
self.move_to(top_left); self.move_to(top_left);
@ -146,8 +126,6 @@ impl Builder {
/// Adds a circle to the [`Path`] given its center coordinate and its /// Adds a circle to the [`Path`] given its center coordinate and its
/// radius. /// radius.
///
/// [`Path`]: struct.Path.html
#[inline] #[inline]
pub fn circle(&mut self, center: Point, radius: f32) { pub fn circle(&mut self, center: Point, radius: f32) {
self.arc(Arc { self.arc(Arc {
@ -160,17 +138,12 @@ impl Builder {
/// Closes the current sub-path in the [`Path`] with a straight line to /// Closes the current sub-path in the [`Path`] with a straight line to
/// the starting point. /// the starting point.
///
/// [`Path`]: struct.Path.html
#[inline] #[inline]
pub fn close(&mut self) { pub fn close(&mut self) {
self.raw.close() self.raw.close()
} }
/// Builds the [`Path`] of this [`Builder`]. /// Builds the [`Path`] of this [`Builder`].
///
/// [`Path`]: struct.Path.html
/// [`Builder`]: struct.Builder.html
#[inline] #[inline]
pub fn build(self) -> Path { pub fn build(self) -> Path {
Path { Path {

View File

@ -7,8 +7,7 @@ use iced_native::{mouse, Rectangle};
/// 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`]: struct.Canvas.html /// [`Canvas`]: crate::widget::Canvas
/// [`Program`]: trait.Program.html
pub trait Program<Message> { pub trait Program<Message> {
/// Updates the state of the [`Program`]. /// Updates the state of the [`Program`].
/// ///
@ -20,9 +19,7 @@ pub trait Program<Message> {
/// ///
/// By default, this method does and returns nothing. /// By default, this method does and returns nothing.
/// ///
/// [`Program`]: trait.Program.html /// [`Canvas`]: crate::widget::Canvas
/// [`Canvas`]: struct.Canvas.html
/// [`Event`]: enum.Event.html
fn update( fn update(
&mut self, &mut self,
_event: Event, _event: Event,
@ -37,10 +34,8 @@ pub trait Program<Message> {
/// [`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`].
/// ///
/// [`Program`]: trait.Program.html /// [`Frame`]: crate::widget::canvas::Cache
/// [`Geometry`]: struct.Geometry.html /// [`Cache`]: crate::widget::canvas::Cache
/// [`Frame`]: struct.Frame.html
/// [`Cache`]: struct.Cache.html
fn draw(&self, bounds: Rectangle, cursor: Cursor) -> Vec<Geometry>; fn draw(&self, bounds: Rectangle, cursor: Cursor) -> Vec<Geometry>;
/// Returns the current mouse interaction of the [`Program`]. /// Returns the current mouse interaction of the [`Program`].
@ -48,8 +43,7 @@ pub trait Program<Message> {
/// 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`].
/// ///
/// [`Program`]: trait.Program.html /// [`Canvas`]: crate::widget::Canvas
/// [`Canvas`]: struct.Canvas.html
fn mouse_interaction( fn mouse_interaction(
&self, &self,
_bounds: Rectangle, _bounds: Rectangle,

View File

@ -16,31 +16,21 @@ pub struct Stroke {
impl Stroke { impl Stroke {
/// Sets the color of the [`Stroke`]. /// Sets the color of the [`Stroke`].
///
/// [`Stroke`]: struct.Stroke.html
pub fn with_color(self, color: Color) -> Stroke { pub fn with_color(self, color: Color) -> Stroke {
Stroke { color, ..self } Stroke { color, ..self }
} }
/// Sets the width of the [`Stroke`]. /// Sets the width of the [`Stroke`].
///
/// [`Stroke`]: struct.Stroke.html
pub fn with_width(self, width: f32) -> Stroke { pub fn with_width(self, width: f32) -> Stroke {
Stroke { width, ..self } Stroke { width, ..self }
} }
/// Sets the [`LineCap`] of the [`Stroke`]. /// Sets the [`LineCap`] of the [`Stroke`].
///
/// [`LineCap`]: enum.LineCap.html
/// [`Stroke`]: struct.Stroke.html
pub fn with_line_cap(self, line_cap: LineCap) -> Stroke { pub fn with_line_cap(self, line_cap: LineCap) -> Stroke {
Stroke { line_cap, ..self } Stroke { line_cap, ..self }
} }
/// Sets the [`LineJoin`] of the [`Stroke`]. /// Sets the [`LineJoin`] of the [`Stroke`].
///
/// [`LineJoin`]: enum.LineJoin.html
/// [`Stroke`]: struct.Stroke.html
pub fn with_line_join(self, line_join: LineJoin) -> Stroke { pub fn with_line_join(self, line_join: LineJoin) -> Stroke {
Stroke { line_join, ..self } Stroke { line_join, ..self }
} }

View File

@ -7,7 +7,6 @@
//! drag and drop, and hotkey support. //! drag and drop, and hotkey support.
//! //!
//! [`pane_grid` example]: https://github.com/hecrj/iced/tree/0.1/examples/pane_grid //! [`pane_grid` example]: https://github.com/hecrj/iced/tree/0.1/examples/pane_grid
//! [`PaneGrid`]: type.PaneGrid.html
use crate::backend::{self, Backend}; use crate::backend::{self, Backend};
use crate::defaults; use crate::defaults;
use crate::{Primitive, Renderer}; use crate::{Primitive, Renderer};

View File

@ -2,8 +2,6 @@
//! //!
//! A [`ProgressBar`] has a range of possible values and a current value, //! A [`ProgressBar`] has a range of possible values and a current value,
//! as well as a length, height and style. //! as well as a length, height and style.
//!
//! [`ProgressBar`]: type.ProgressBar.html
use crate::{Backend, Primitive, Renderer}; use crate::{Backend, Primitive, Renderer};
use iced_native::mouse; use iced_native::mouse;
use iced_native::progress_bar; use iced_native::progress_bar;

View File

@ -1,9 +1,6 @@
//! Display an interactive selector of a single value from a range of values. //! Display an interactive selector of a single value from a range of values.
//! //!
//! A [`Slider`] has some local [`State`]. //! A [`Slider`] has some local [`State`].
//!
//! [`Slider`]: struct.Slider.html
//! [`State`]: struct.State.html
use crate::{Backend, Primitive, Renderer}; use crate::{Backend, Primitive, Renderer};
use iced_native::mouse; use iced_native::mouse;
use iced_native::slider; use iced_native::slider;

View File

@ -1,9 +1,6 @@
//! Display fields that can be filled with text. //! Display fields that can be filled with text.
//! //!
//! A [`TextInput`] has some local [`State`]. //! A [`TextInput`] has some local [`State`].
//!
//! [`TextInput`]: struct.TextInput.html
//! [`State`]: struct.State.html
use crate::backend::{self, Backend}; use crate::backend::{self, Backend};
use crate::{Primitive, Renderer}; use crate::{Primitive, Renderer};
use iced_native::mouse; use iced_native::mouse;

View File

@ -16,14 +16,12 @@ pub trait Compositor: Sized {
/// The swap chain of the backend. /// The swap chain of the backend.
type SwapChain; type SwapChain;
/// Creates a new [`Backend`]. /// Creates a new [`Compositor`].
///
/// [`Backend`]: trait.Backend.html
fn new(settings: Self::Settings) -> Result<(Self, Self::Renderer), Error>; fn new(settings: Self::Settings) -> Result<(Self, Self::Renderer), Error>;
/// Crates a new [`Surface`] for the given window. /// Crates a new [`Surface`] for the given window.
/// ///
/// [`Surface`]: #associatedtype.Surface /// [`Surface`]: Self::Surface
fn create_surface<W: HasRawWindowHandle>( fn create_surface<W: HasRawWindowHandle>(
&mut self, &mut self,
window: &W, window: &W,
@ -31,8 +29,8 @@ pub trait Compositor: Sized {
/// Crates a new [`SwapChain`] for the given [`Surface`]. /// Crates a new [`SwapChain`] for the given [`Surface`].
/// ///
/// [`SwapChain`]: #associatedtype.SwapChain /// [`SwapChain`]: Self::SwapChain
/// [`Surface`]: #associatedtype.Surface /// [`Surface`]: Self::Surface
fn create_swap_chain( fn create_swap_chain(
&mut self, &mut self,
surface: &Self::Surface, surface: &Self::Surface,
@ -42,8 +40,7 @@ pub trait Compositor: Sized {
/// Draws the output primitives to the next frame of the given [`SwapChain`]. /// Draws the output primitives to the next frame of the given [`SwapChain`].
/// ///
/// [`SwapChain`]: #associatedtype.SwapChain /// [`SwapChain`]: Self::SwapChain
/// [`Surface`]: #associatedtype.Surface
fn draw<T: AsRef<str>>( fn draw<T: AsRef<str>>(
&mut self, &mut self,
renderer: &mut Self::Renderer, renderer: &mut Self::Renderer,

View File

@ -2,7 +2,5 @@
/// applications. /// applications.
pub trait Clipboard { pub trait Clipboard {
/// Returns the current content of the [`Clipboard`] as text. /// Returns the current content of the [`Clipboard`] as text.
///
/// [`Clipboard`]: trait.Clipboard.html
fn content(&self) -> Option<String>; fn content(&self) -> Option<String>;
} }

View File

@ -32,9 +32,7 @@ pub struct Debug {
} }
impl Debug { impl Debug {
/// Creates a new [`Debug`]. /// Creates a new [`struct@Debug`].
///
/// [`Debug`]: struct.Debug.html
pub fn new() -> Self { pub fn new() -> Self {
let now = time::Instant::now(); let now = time::Instant::now();

View File

@ -14,8 +14,6 @@ use crate::{
/// to turn it into an [`Element`]. /// to turn it into an [`Element`].
/// ///
/// [built-in widget]: widget/index.html#built-in-widgets /// [built-in widget]: widget/index.html#built-in-widgets
/// [`Widget`]: widget/trait.Widget.html
/// [`Element`]: struct.Element.html
#[allow(missing_debug_implementations)] #[allow(missing_debug_implementations)]
pub struct Element<'a, Message, Renderer> { pub struct Element<'a, Message, Renderer> {
pub(crate) widget: Box<dyn Widget<Message, Renderer> + 'a>, pub(crate) widget: Box<dyn Widget<Message, Renderer> + 'a>,
@ -26,9 +24,6 @@ where
Renderer: crate::Renderer, Renderer: crate::Renderer,
{ {
/// Creates a new [`Element`] containing the given [`Widget`]. /// Creates a new [`Element`] containing the given [`Widget`].
///
/// [`Element`]: struct.Element.html
/// [`Widget`]: widget/trait.Widget.html
pub fn new( pub fn new(
widget: impl Widget<Message, Renderer> + 'a, widget: impl Widget<Message, Renderer> + 'a,
) -> Element<'a, Message, Renderer> { ) -> Element<'a, Message, Renderer> {
@ -42,8 +37,6 @@ where
/// This method is useful when you want to decouple different parts of your /// This method is useful when you want to decouple different parts of your
/// UI and make them __composable__. /// UI and make them __composable__.
/// ///
/// [`Element`]: struct.Element.html
///
/// # Example /// # Example
/// Imagine we want to use [our counter](index.html#usage). But instead of /// Imagine we want to use [our counter](index.html#usage). But instead of
/// showing a single counter, we want to display many of them. We can reuse /// showing a single counter, we want to display many of them. We can reuse
@ -189,8 +182,7 @@ where
/// The [`Renderer`] will explain the layout of the [`Element`] graphically. /// The [`Renderer`] will explain the layout of the [`Element`] graphically.
/// This can be very useful for debugging your layout! /// This can be very useful for debugging your layout!
/// ///
/// [`Element`]: struct.Element.html /// [`Renderer`]: crate::Renderer
/// [`Renderer`]: trait.Renderer.html
pub fn explain<C: Into<Color>>( pub fn explain<C: Into<Color>>(
self, self,
color: C, color: C,
@ -205,23 +197,18 @@ where
} }
/// Returns the width of the [`Element`]. /// Returns the width of the [`Element`].
///
/// [`Element`]: struct.Element.html
pub fn width(&self) -> Length { pub fn width(&self) -> Length {
self.widget.width() self.widget.width()
} }
/// Returns the height of the [`Element`]. /// Returns the height of the [`Element`].
///
/// [`Element`]: struct.Element.html
pub fn height(&self) -> Length { pub fn height(&self) -> Length {
self.widget.height() self.widget.height()
} }
/// Computes the layout of the [`Element`] in the given [`Limits`]. /// Computes the layout of the [`Element`] in the given [`Limits`].
/// ///
/// [`Element`]: struct.Element.html /// [`Limits`]: layout::Limits
/// [`Limits`]: layout/struct.Limits.html
pub fn layout( pub fn layout(
&self, &self,
renderer: &Renderer, renderer: &Renderer,
@ -231,8 +218,6 @@ where
} }
/// Processes a runtime [`Event`]. /// Processes a runtime [`Event`].
///
/// [`Event`]: enum.Event.html
pub fn on_event( pub fn on_event(
&mut self, &mut self,
event: Event, event: Event,
@ -253,9 +238,6 @@ where
} }
/// Draws the [`Element`] and its children using the given [`Layout`]. /// Draws the [`Element`] and its children using the given [`Layout`].
///
/// [`Element`]: struct.Element.html
/// [`Layout`]: layout/struct.Layout.html
pub fn draw( pub fn draw(
&self, &self,
renderer: &mut Renderer, renderer: &mut Renderer,
@ -269,15 +251,11 @@ where
} }
/// Computes the _layout_ hash of the [`Element`]. /// Computes the _layout_ hash of the [`Element`].
///
/// [`Element`]: struct.Element.html
pub fn hash_layout(&self, state: &mut Hasher) { pub fn hash_layout(&self, state: &mut Hasher) {
self.widget.hash_layout(state); self.widget.hash_layout(state);
} }
/// Returns the overlay of the [`Element`], if there is any. /// Returns the overlay of the [`Element`], if there is any.
///
/// [`Element`]: struct.Element.html
pub fn overlay<'b>( pub fn overlay<'b>(
&'b mut self, &'b mut self,
layout: Layout<'_>, layout: Layout<'_>,

View File

@ -20,19 +20,12 @@ pub enum Event {
} }
/// The status of an [`Event`] after being processed. /// The status of an [`Event`] after being processed.
///
/// [`Event`]: enum.Event.html
/// [`UserInterface`]: ../struct.UserInterface.html
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Status { pub enum Status {
/// The [`Event`] was **NOT** handled by any widget. /// The [`Event`] was **NOT** handled by any widget.
///
/// [`Event`]: enum.Event.html
Ignored, Ignored,
/// The [`Event`] was handled and processed by a widget. /// The [`Event`] was handled and processed by a widget.
///
/// [`Event`]: enum.Event.html
Captured, Captured,
} }

View File

@ -12,8 +12,6 @@ pub use node::Node;
use crate::{Point, Rectangle, Vector}; use crate::{Point, Rectangle, Vector};
/// The bounds of a [`Node`] and its children, using absolute coordinates. /// The bounds of a [`Node`] and its children, using absolute coordinates.
///
/// [`Node`]: struct.Node.html
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub struct Layout<'a> { pub struct Layout<'a> {
position: Point, position: Point,
@ -35,8 +33,6 @@ impl<'a> Layout<'a> {
} }
/// Returns the position of the [`Layout`]. /// Returns the position of the [`Layout`].
///
/// [`Layout`]: struct.Layout.html
pub fn position(&self) -> Point { pub fn position(&self) -> Point {
self.position self.position
} }
@ -45,10 +41,6 @@ impl<'a> Layout<'a> {
/// ///
/// The returned [`Rectangle`] describes the position and size of a /// The returned [`Rectangle`] describes the position and size of a
/// [`Node`]. /// [`Node`].
///
/// [`Layout`]: struct.Layout.html
/// [`Rectangle`]: struct.Rectangle.html
/// [`Node`]: struct.Node.html
pub fn bounds(&self) -> Rectangle { pub fn bounds(&self) -> Rectangle {
let bounds = self.node.bounds(); let bounds = self.node.bounds();
@ -61,9 +53,6 @@ impl<'a> Layout<'a> {
} }
/// Returns an iterator over the [`Layout`] of the children of a [`Node`]. /// Returns an iterator over the [`Layout`] of the children of a [`Node`].
///
/// [`Layout`]: struct.Layout.html
/// [`Node`]: struct.Node.html
pub fn children(self) -> impl Iterator<Item = Layout<'a>> { pub fn children(self) -> impl Iterator<Item = Layout<'a>> {
self.node.children().iter().map(move |node| { self.node.children().iter().map(move |node| {
Layout::with_offset( Layout::with_offset(

View File

@ -1,8 +1,6 @@
use crate::{Color, Layout, Point, Rectangle, Renderer, Widget}; use crate::{Color, Layout, Point, Rectangle, Renderer, Widget};
/// A renderer able to graphically explain a [`Layout`]. /// A renderer able to graphically explain a [`Layout`].
///
/// [`Layout`]: struct.Layout.html
pub trait Debugger: Renderer { pub trait Debugger: Renderer {
/// Explains the [`Layout`] of an [`Element`] for debugging purposes. /// Explains the [`Layout`] of an [`Element`] for debugging purposes.
/// ///
@ -12,9 +10,8 @@ pub trait Debugger: Renderer {
/// A common approach consists in recursively rendering the bounds of the /// A common approach consists in recursively rendering the bounds of the
/// [`Layout`] and its children. /// [`Layout`] and its children.
/// ///
/// [`Layout`]: struct.Layout.html /// [`Element`]: crate::Element
/// [`Element`]: ../struct.Element.html /// [`Element::explain`]: crate::Element::explain
/// [`Element::explain`]: ../struct.Element.html#method.explain
fn explain<Message>( fn explain<Message>(
&mut self, &mut self,
defaults: &Self::Defaults, defaults: &Self::Defaults,

View File

@ -58,8 +58,6 @@ impl Axis {
/// padding and alignment to the items as needed. /// padding and alignment to the items as needed.
/// ///
/// It returns a new layout [`Node`]. /// It returns a new layout [`Node`].
///
/// [`Node`]: ../struct.Node.html
pub fn resolve<Message, Renderer>( pub fn resolve<Message, Renderer>(
axis: Axis, axis: Axis,
renderer: &Renderer, renderer: &Renderer,

View File

@ -17,9 +17,6 @@ impl Limits {
}; };
/// Creates new [`Limits`] with the given minimum and maximum [`Size`]. /// Creates new [`Limits`] with the given minimum and maximum [`Size`].
///
/// [`Limits`]: struct.Limits.html
/// [`Size`]: ../struct.Size.html
pub const fn new(min: Size, max: Size) -> Limits { pub const fn new(min: Size, max: Size) -> Limits {
Limits { Limits {
min, min,
@ -29,32 +26,21 @@ impl Limits {
} }
/// Returns the minimum [`Size`] of the [`Limits`]. /// Returns the minimum [`Size`] of the [`Limits`].
///
/// [`Limits`]: struct.Limits.html
/// [`Size`]: ../struct.Size.html
pub fn min(&self) -> Size { pub fn min(&self) -> Size {
self.min self.min
} }
/// Returns the maximum [`Size`] of the [`Limits`]. /// Returns the maximum [`Size`] of the [`Limits`].
///
/// [`Limits`]: struct.Limits.html
/// [`Size`]: ../struct.Size.html
pub fn max(&self) -> Size { pub fn max(&self) -> Size {
self.max self.max
} }
/// Returns the fill [`Size`] of the [`Limits`]. /// Returns the fill [`Size`] of the [`Limits`].
///
/// [`Limits`]: struct.Limits.html
/// [`Size`]: ../struct.Size.html
pub fn fill(&self) -> Size { pub fn fill(&self) -> Size {
self.fill self.fill
} }
/// Applies a width constraint to the current [`Limits`]. /// Applies a width constraint to the current [`Limits`].
///
/// [`Limits`]: struct.Limits.html
pub fn width(mut self, width: Length) -> Limits { pub fn width(mut self, width: Length) -> Limits {
match width { match width {
Length::Shrink => { Length::Shrink => {
@ -77,8 +63,6 @@ impl Limits {
} }
/// Applies a height constraint to the current [`Limits`]. /// Applies a height constraint to the current [`Limits`].
///
/// [`Limits`]: struct.Limits.html
pub fn height(mut self, height: Length) -> Limits { pub fn height(mut self, height: Length) -> Limits {
match height { match height {
Length::Shrink => { Length::Shrink => {
@ -101,8 +85,6 @@ impl Limits {
} }
/// Applies a minimum width constraint to the current [`Limits`]. /// Applies a minimum width constraint to the current [`Limits`].
///
/// [`Limits`]: struct.Limits.html
pub fn min_width(mut self, min_width: u32) -> Limits { pub fn min_width(mut self, min_width: u32) -> Limits {
self.min.width = self.min.width =
self.min.width.max(min_width as f32).min(self.max.width); self.min.width.max(min_width as f32).min(self.max.width);
@ -111,8 +93,6 @@ impl Limits {
} }
/// Applies a maximum width constraint to the current [`Limits`]. /// Applies a maximum width constraint to the current [`Limits`].
///
/// [`Limits`]: struct.Limits.html
pub fn max_width(mut self, max_width: u32) -> Limits { pub fn max_width(mut self, max_width: u32) -> Limits {
self.max.width = self.max.width =
self.max.width.min(max_width as f32).max(self.min.width); self.max.width.min(max_width as f32).max(self.min.width);
@ -121,8 +101,6 @@ impl Limits {
} }
/// Applies a minimum height constraint to the current [`Limits`]. /// Applies a minimum height constraint to the current [`Limits`].
///
/// [`Limits`]: struct.Limits.html
pub fn min_height(mut self, min_height: u32) -> Limits { pub fn min_height(mut self, min_height: u32) -> Limits {
self.min.height = self.min.height =
self.min.height.max(min_height as f32).min(self.max.height); self.min.height.max(min_height as f32).min(self.max.height);
@ -131,8 +109,6 @@ impl Limits {
} }
/// Applies a maximum height constraint to the current [`Limits`]. /// Applies a maximum height constraint to the current [`Limits`].
///
/// [`Limits`]: struct.Limits.html
pub fn max_height(mut self, max_height: u32) -> Limits { pub fn max_height(mut self, max_height: u32) -> Limits {
self.max.height = self.max.height =
self.max.height.min(max_height as f32).max(self.min.height); self.max.height.min(max_height as f32).max(self.min.height);
@ -141,16 +117,11 @@ impl Limits {
} }
/// Shrinks the current [`Limits`] to account for the given padding. /// Shrinks the current [`Limits`] to account for the given padding.
///
/// [`Limits`]: struct.Limits.html
pub fn pad(&self, padding: f32) -> Limits { pub fn pad(&self, padding: f32) -> Limits {
self.shrink(Size::new(padding * 2.0, padding * 2.0)) self.shrink(Size::new(padding * 2.0, padding * 2.0))
} }
/// Shrinks the current [`Limits`] by the given [`Size`]. /// Shrinks the current [`Limits`] by the given [`Size`].
///
/// [`Limits`]: struct.Limits.html
/// [`Size`]: ../struct.Size.html
pub fn shrink(&self, size: Size) -> Limits { pub fn shrink(&self, size: Size) -> Limits {
let min = Size::new( let min = Size::new(
(self.min().width - size.width).max(0.0), (self.min().width - size.width).max(0.0),
@ -171,8 +142,6 @@ impl Limits {
} }
/// Removes the minimum width constraint for the current [`Limits`]. /// Removes the minimum width constraint for the current [`Limits`].
///
/// [`Limits`]: struct.Limits.html
pub fn loose(&self) -> Limits { pub fn loose(&self) -> Limits {
Limits { Limits {
min: Size::ZERO, min: Size::ZERO,
@ -183,8 +152,6 @@ impl Limits {
/// Computes the resulting [`Size`] that fits the [`Limits`] given the /// Computes the resulting [`Size`] that fits the [`Limits`] given the
/// intrinsic size of some content. /// intrinsic size of some content.
///
/// [`Limits`]: struct.Limits.html
pub fn resolve(&self, intrinsic_size: Size) -> Size { pub fn resolve(&self, intrinsic_size: Size) -> Size {
Size::new( Size::new(
intrinsic_size intrinsic_size

View File

@ -9,17 +9,11 @@ pub struct Node {
impl Node { impl Node {
/// Creates a new [`Node`] with the given [`Size`]. /// Creates a new [`Node`] with the given [`Size`].
///
/// [`Node`]: struct.Node.html
/// [`Size`]: ../struct.Size.html
pub const fn new(size: Size) -> Self { pub const fn new(size: Size) -> Self {
Self::with_children(size, Vec::new()) Self::with_children(size, Vec::new())
} }
/// Creates a new [`Node`] with the given [`Size`] and children. /// Creates a new [`Node`] with the given [`Size`] and children.
///
/// [`Node`]: struct.Node.html
/// [`Size`]: ../struct.Size.html
pub const fn with_children(size: Size, children: Vec<Node>) -> Self { pub const fn with_children(size: Size, children: Vec<Node>) -> Self {
Node { Node {
bounds: Rectangle { bounds: Rectangle {
@ -33,30 +27,21 @@ impl Node {
} }
/// Returns the [`Size`] of the [`Node`]. /// Returns the [`Size`] of the [`Node`].
///
/// [`Node`]: struct.Node.html
/// [`Size`]: ../struct.Size.html
pub fn size(&self) -> Size { pub fn size(&self) -> Size {
Size::new(self.bounds.width, self.bounds.height) Size::new(self.bounds.width, self.bounds.height)
} }
/// Returns the bounds of the [`Node`]. /// Returns the bounds of the [`Node`].
///
/// [`Node`]: struct.Node.html
pub fn bounds(&self) -> Rectangle { pub fn bounds(&self) -> Rectangle {
self.bounds self.bounds
} }
/// Returns the children of the [`Node`]. /// Returns the children of the [`Node`].
///
/// [`Node`]: struct.Node.html
pub fn children(&self) -> &[Node] { pub fn children(&self) -> &[Node] {
&self.children &self.children
} }
/// Aligns the [`Node`] in the given space. /// Aligns the [`Node`] in the given space.
///
/// [`Node`]: struct.Node.html
pub fn align( pub fn align(
&mut self, &mut self,
horizontal_alignment: Align, horizontal_alignment: Align,
@ -85,8 +70,6 @@ impl Node {
} }
/// Moves the [`Node`] to the given position. /// Moves the [`Node`] to the given position.
///
/// [`Node`]: struct.Node.html
pub fn move_to(&mut self, position: Point) { pub fn move_to(&mut self, position: Point) {
self.bounds.x = position.x; self.bounds.x = position.x;
self.bounds.y = position.y; self.bounds.y = position.y;

View File

@ -27,9 +27,7 @@
//! [`iced_winit`]: https://github.com/hecrj/iced/tree/master/winit //! [`iced_winit`]: https://github.com/hecrj/iced/tree/master/winit
//! [`druid`]: https://github.com/xi-editor/druid //! [`druid`]: https://github.com/xi-editor/druid
//! [`raw-window-handle`]: https://github.com/rust-windowing/raw-window-handle //! [`raw-window-handle`]: https://github.com/rust-windowing/raw-window-handle
//! [`Widget`]: widget/trait.Widget.html //! [renderer]: crate::renderer
//! [`UserInterface`]: struct.UserInterface.html
//! [renderer]: renderer/index.html
#![deny(missing_docs)] #![deny(missing_docs)]
#![deny(missing_debug_implementations)] #![deny(missing_debug_implementations)]
#![deny(unused_results)] #![deny(unused_results)]

View File

@ -36,8 +36,6 @@ impl Kind {
impl Click { impl Click {
/// Creates a new [`Click`] with the given position and previous last /// Creates a new [`Click`] with the given position and previous last
/// [`Click`]. /// [`Click`].
///
/// [`Click`]: struct.Click.html
pub fn new(position: Point, previous: Option<Click>) -> Click { pub fn new(position: Point, previous: Option<Click>) -> Click {
let time = Instant::now(); let time = Instant::now();
@ -59,9 +57,6 @@ impl Click {
} }
/// Returns the [`Kind`] of [`Click`]. /// Returns the [`Kind`] of [`Click`].
///
/// [`Kind`]: enum.Kind.html
/// [`Click`]: struct.Click.html
pub fn kind(&self) -> Kind { pub fn kind(&self) -> Kind {
self.kind self.kind
} }

View File

@ -20,9 +20,7 @@ where
/// This [`Node`] is used by the runtime to compute the [`Layout`] of the /// This [`Node`] is used by the runtime to compute the [`Layout`] of the
/// user interface. /// user interface.
/// ///
/// [`Node`]: ../layout/struct.Node.html /// [`Node`]: layout::Node
/// [`Widget`]: trait.Overlay.html
/// [`Layout`]: ../layout/struct.Layout.html
fn layout( fn layout(
&self, &self,
renderer: &Renderer, renderer: &Renderer,
@ -31,8 +29,6 @@ where
) -> layout::Node; ) -> layout::Node;
/// Draws the [`Overlay`] using the associated `Renderer`. /// Draws the [`Overlay`] using the associated `Renderer`.
///
/// [`Overlay`]: trait.Overlay.html
fn draw( fn draw(
&self, &self,
renderer: &mut Renderer, renderer: &mut Renderer,
@ -51,9 +47,7 @@ where
/// For example, the [`Text`] widget does not hash its color property, as /// For example, the [`Text`] widget does not hash its color property, as
/// its value cannot affect the overall [`Layout`] of the user interface. /// its value cannot affect the overall [`Layout`] of the user interface.
/// ///
/// [`Overlay`]: trait.Overlay.html /// [`Text`]: crate::widget::Text
/// [`Layout`]: ../layout/struct.Layout.html
/// [`Text`]: text/struct.Text.html
fn hash_layout(&self, state: &mut Hasher, position: Point); fn hash_layout(&self, state: &mut Hasher, position: Point);
/// Processes a runtime [`Event`]. /// Processes a runtime [`Event`].
@ -68,11 +62,6 @@ where
/// * a [`Clipboard`], if available /// * a [`Clipboard`], if available
/// ///
/// By default, it does nothing. /// By default, it does nothing.
///
/// [`Event`]: ../enum.Event.html
/// [`Overlay`]: trait.Widget.html
/// [`Layout`]: ../layout/struct.Layout.html
/// [`Clipboard`]: ../trait.Clipboard.html
fn on_event( fn on_event(
&mut self, &mut self,
_event: Event, _event: Event,

View File

@ -5,8 +5,6 @@ use crate::layout;
use crate::{Clipboard, Hasher, Layout, Point, Size, Vector}; use crate::{Clipboard, Hasher, Layout, Point, Size, Vector};
/// A generic [`Overlay`]. /// A generic [`Overlay`].
///
/// [`Overlay`]: trait.Overlay.html
#[allow(missing_debug_implementations)] #[allow(missing_debug_implementations)]
pub struct Element<'a, Message, Renderer> { pub struct Element<'a, Message, Renderer> {
position: Point, position: Point,
@ -18,9 +16,6 @@ where
Renderer: crate::Renderer, Renderer: crate::Renderer,
{ {
/// Creates a new [`Element`] containing the given [`Overlay`]. /// Creates a new [`Element`] containing the given [`Overlay`].
///
/// [`Element`]: struct.Element.html
/// [`Overlay`]: trait.Overlay.html
pub fn new( pub fn new(
position: Point, position: Point,
overlay: Box<dyn Overlay<Message, Renderer> + 'a>, overlay: Box<dyn Overlay<Message, Renderer> + 'a>,
@ -29,16 +24,12 @@ where
} }
/// Translates the [`Element`]. /// Translates the [`Element`].
///
/// [`Element`]: struct.Element.html
pub fn translate(mut self, translation: Vector) -> Self { pub fn translate(mut self, translation: Vector) -> Self {
self.position = self.position + translation; self.position = self.position + translation;
self self
} }
/// Applies a transformation to the produced message of the [`Element`]. /// Applies a transformation to the produced message of the [`Element`].
///
/// [`Element`]: struct.Element.html
pub fn map<B>(self, f: &'a dyn Fn(Message) -> B) -> Element<'a, B, Renderer> pub fn map<B>(self, f: &'a dyn Fn(Message) -> B) -> Element<'a, B, Renderer>
where where
Message: 'a, Message: 'a,
@ -52,15 +43,11 @@ where
} }
/// Computes the layout of the [`Element`] in the given bounds. /// Computes the layout of the [`Element`] in the given bounds.
///
/// [`Element`]: struct.Element.html
pub fn layout(&self, renderer: &Renderer, bounds: Size) -> layout::Node { pub fn layout(&self, renderer: &Renderer, bounds: Size) -> layout::Node {
self.overlay.layout(renderer, bounds, self.position) self.overlay.layout(renderer, bounds, self.position)
} }
/// Processes a runtime [`Event`]. /// Processes a runtime [`Event`].
///
/// [`Event`]: enum.Event.html
pub fn on_event( pub fn on_event(
&mut self, &mut self,
event: Event, event: Event,
@ -81,9 +68,6 @@ where
} }
/// Draws the [`Element`] and its children using the given [`Layout`]. /// Draws the [`Element`] and its children using the given [`Layout`].
///
/// [`Element`]: struct.Element.html
/// [`Layout`]: layout/struct.Layout.html
pub fn draw( pub fn draw(
&self, &self,
renderer: &mut Renderer, renderer: &mut Renderer,
@ -96,8 +80,6 @@ where
} }
/// Computes the _layout_ hash of the [`Element`]. /// Computes the _layout_ hash of the [`Element`].
///
/// [`Element`]: struct.Element.html
pub fn hash_layout(&self, state: &mut Hasher) { pub fn hash_layout(&self, state: &mut Hasher) {
self.overlay.hash_layout(state, self.position); self.overlay.hash_layout(state, self.position);
} }

View File

@ -32,9 +32,6 @@ where
{ {
/// Creates a new [`Menu`] with the given [`State`], a list of options, and /// Creates a new [`Menu`] with the given [`State`], a list of options, and
/// the message to produced when an option is selected. /// the message to produced when an option is selected.
///
/// [`Menu`]: struct.Menu.html
/// [`State`]: struct.State.html
pub fn new( pub fn new(
state: &'a mut State, state: &'a mut State,
options: &'a [T], options: &'a [T],
@ -55,40 +52,30 @@ where
} }
/// Sets the width of the [`Menu`]. /// Sets the width of the [`Menu`].
///
/// [`Menu`]: struct.Menu.html
pub fn width(mut self, width: u16) -> Self { pub fn width(mut self, width: u16) -> Self {
self.width = width; self.width = width;
self self
} }
/// Sets the padding of the [`Menu`]. /// Sets the padding of the [`Menu`].
///
/// [`Menu`]: struct.Menu.html
pub fn padding(mut self, padding: u16) -> Self { pub fn padding(mut self, padding: u16) -> Self {
self.padding = padding; self.padding = padding;
self self
} }
/// Sets the text size of the [`Menu`]. /// Sets the text size of the [`Menu`].
///
/// [`Menu`]: struct.Menu.html
pub fn text_size(mut self, text_size: u16) -> Self { pub fn text_size(mut self, text_size: u16) -> Self {
self.text_size = Some(text_size); self.text_size = Some(text_size);
self self
} }
/// Sets the font of the [`Menu`]. /// Sets the font of the [`Menu`].
///
/// [`Menu`]: struct.Menu.html
pub fn font(mut self, font: Renderer::Font) -> Self { pub fn font(mut self, font: Renderer::Font) -> Self {
self.font = font; self.font = font;
self self
} }
/// Sets the style of the [`Menu`]. /// Sets the style of the [`Menu`].
///
/// [`Menu`]: struct.Menu.html
pub fn style( pub fn style(
mut self, mut self,
style: impl Into<<Renderer as self::Renderer>::Style>, style: impl Into<<Renderer as self::Renderer>::Style>,
@ -103,8 +90,6 @@ where
/// The `target_height` will be used to display the menu either on top /// The `target_height` will be used to display the menu either on top
/// of the target or under it, depending on the screen position and the /// of the target or under it, depending on the screen position and the
/// dimensions of the [`Menu`]. /// dimensions of the [`Menu`].
///
/// [`Menu`]: struct.Menu.html
pub fn overlay<Message: 'a>( pub fn overlay<Message: 'a>(
self, self,
position: Point, position: Point,
@ -118,8 +103,6 @@ where
} }
/// The local state of a [`Menu`]. /// The local state of a [`Menu`].
///
/// [`Menu`]: struct.Menu.html
#[derive(Debug, Clone, Default)] #[derive(Debug, Clone, Default)]
pub struct State { pub struct State {
scrollable: scrollable::State, scrollable: scrollable::State,
@ -127,9 +110,6 @@ pub struct State {
impl State { impl State {
/// Creates a new [`State`] for a [`Menu`]. /// Creates a new [`State`] for a [`Menu`].
///
/// [`State`]: struct.State.html
/// [`Menu`]: struct.Menu.html
pub fn new() -> Self { pub fn new() -> Self {
Self::default() Self::default()
} }
@ -402,21 +382,16 @@ where
/// Your [renderer] will need to implement this trait before being /// Your [renderer] will need to implement this trait before being
/// able to use a [`Menu`] in your user interface. /// able to use a [`Menu`] in your user interface.
/// ///
/// [`Menu`]: struct.Menu.html /// [renderer]: crate::renderer
/// [renderer]: ../../renderer/index.html
pub trait Renderer: pub trait Renderer:
scrollable::Renderer + container::Renderer + text::Renderer scrollable::Renderer + container::Renderer + text::Renderer
{ {
/// The [`Menu`] style supported by this renderer. /// The [`Menu`] style supported by this renderer.
///
/// [`Menu`]: struct.Menu.html
type Style: Default + Clone; type Style: Default + Clone;
/// Decorates a the list of options of a [`Menu`]. /// Decorates a the list of options of a [`Menu`].
/// ///
/// This method can be used to draw a background for the [`Menu`]. /// This method can be used to draw a background for the [`Menu`].
///
/// [`Menu`]: struct.Menu.html
fn decorate( fn decorate(
&mut self, &mut self,
bounds: Rectangle, bounds: Rectangle,
@ -426,8 +401,6 @@ pub trait Renderer:
) -> Self::Output; ) -> Self::Output;
/// Draws the list of options of a [`Menu`]. /// Draws the list of options of a [`Menu`].
///
/// [`Menu`]: struct.Menu.html
fn draw<T: ToString>( fn draw<T: ToString>(
&mut self, &mut self,
bounds: Rectangle, bounds: Rectangle,

View File

@ -8,13 +8,9 @@ pub use state::State;
/// The core of a user interface application following The Elm Architecture. /// The core of a user interface application following The Elm Architecture.
pub trait Program: Sized { pub trait Program: Sized {
/// The graphics backend to use to draw the [`Program`]. /// The graphics backend to use to draw the [`Program`].
///
/// [`Program`]: trait.Program.html
type Renderer: Renderer; type Renderer: Renderer;
/// The type of __messages__ your [`Program`] will produce. /// The type of __messages__ your [`Program`] will produce.
///
/// [`Program`]: trait.Program.html
type Message: std::fmt::Debug + Send; type Message: std::fmt::Debug + Send;
/// Handles a __message__ and updates the state of the [`Program`]. /// Handles a __message__ and updates the state of the [`Program`].
@ -25,15 +21,10 @@ pub trait Program: Sized {
/// ///
/// Any [`Command`] returned will be executed immediately in the /// Any [`Command`] returned will be executed immediately in the
/// background by shells. /// background by shells.
///
/// [`Program`]: trait.Application.html
/// [`Command`]: struct.Command.html
fn update(&mut self, message: Self::Message) -> Command<Self::Message>; fn update(&mut self, message: Self::Message) -> Command<Self::Message>;
/// Returns the widgets to display in the [`Program`]. /// Returns the widgets to display in the [`Program`].
/// ///
/// These widgets can produce __messages__ based on user interaction. /// These widgets can produce __messages__ based on user interaction.
///
/// [`Program`]: trait.Program.html
fn view(&mut self) -> Element<'_, Self::Message, Self::Renderer>; fn view(&mut self) -> Element<'_, Self::Message, Self::Renderer>;
} }

View File

@ -5,8 +5,6 @@ use crate::{
/// The execution state of a [`Program`]. It leverages caching, event /// The execution state of a [`Program`]. It leverages caching, event
/// processing, and rendering primitive storage. /// processing, and rendering primitive storage.
///
/// [`Program`]: trait.Program.html
#[allow(missing_debug_implementations)] #[allow(missing_debug_implementations)]
pub struct State<P> pub struct State<P>
where where
@ -25,9 +23,6 @@ where
{ {
/// Creates a new [`State`] with the provided [`Program`], initializing its /// Creates a new [`State`] with the provided [`Program`], initializing its
/// primitive with the given logical bounds and renderer. /// primitive with the given logical bounds and renderer.
///
/// [`State`]: struct.State.html
/// [`Program`]: trait.Program.html
pub fn new( pub fn new(
mut program: P, mut program: P,
bounds: Size, bounds: Size,
@ -59,39 +54,30 @@ where
} }
/// Returns a reference to the [`Program`] of the [`State`]. /// Returns a reference to the [`Program`] of the [`State`].
///
/// [`Program`]: trait.Program.html
/// [`State`]: struct.State.html
pub fn program(&self) -> &P { pub fn program(&self) -> &P {
&self.program &self.program
} }
/// Returns a reference to the current rendering primitive of the [`State`]. /// Returns a reference to the current rendering primitive of the [`State`].
///
/// [`State`]: struct.State.html
pub fn primitive(&self) -> &<P::Renderer as Renderer>::Output { pub fn primitive(&self) -> &<P::Renderer as Renderer>::Output {
&self.primitive &self.primitive
} }
/// Queues an event in the [`State`] for processing during an [`update`]. /// Queues an event in the [`State`] for processing during an [`update`].
/// ///
/// [`State`]: struct.State.html /// [`update`]: Self::update
/// [`update`]: #method.update
pub fn queue_event(&mut self, event: Event) { pub fn queue_event(&mut self, event: Event) {
self.queued_events.push(event); self.queued_events.push(event);
} }
/// Queues a message in the [`State`] for processing during an [`update`]. /// Queues a message in the [`State`] for processing during an [`update`].
/// ///
/// [`State`]: struct.State.html /// [`update`]: Self::update
/// [`update`]: #method.update
pub fn queue_message(&mut self, message: P::Message) { pub fn queue_message(&mut self, message: P::Message) {
self.queued_messages.push(message); self.queued_messages.push(message);
} }
/// Returns whether the event queue of the [`State`] is empty or not. /// Returns whether the event queue of the [`State`] is empty or not.
///
/// [`State`]: struct.State.html
pub fn is_queue_empty(&self) -> bool { pub fn is_queue_empty(&self) -> bool {
self.queued_events.is_empty() && self.queued_messages.is_empty() self.queued_events.is_empty() && self.queued_messages.is_empty()
} }
@ -101,8 +87,6 @@ where
/// ///
/// Returns the [`Command`] obtained from [`Program`] after updating it, /// Returns the [`Command`] obtained from [`Program`] after updating it,
/// only if an update was necessary. /// only if an update was necessary.
///
/// [`Program`]: trait.Program.html
pub fn update( pub fn update(
&mut self, &mut self,
bounds: Size, bounds: Size,

View File

@ -13,12 +13,12 @@
//! In the end, a __renderer__ satisfying all the constraints is //! In the end, a __renderer__ satisfying all the constraints is
//! needed to build a [`UserInterface`]. //! needed to build a [`UserInterface`].
//! //!
//! [`Widget`]: ../widget/trait.Widget.html //! [`Widget`]: crate::Widget
//! [`UserInterface`]: ../struct.UserInterface.html //! [`UserInterface`]: crate::UserInterface
//! [`Text`]: ../widget/text/struct.Text.html //! [`Text`]: crate::widget::Text
//! [`text::Renderer`]: ../widget/text/trait.Renderer.html //! [`text::Renderer`]: crate::widget::text::Renderer
//! [`Checkbox`]: ../widget/checkbox/struct.Checkbox.html //! [`Checkbox`]: crate::widget::Checkbox
//! [`checkbox::Renderer`]: ../widget/checkbox/trait.Renderer.html //! [`checkbox::Renderer`]: crate::widget::checkbox::Renderer
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
mod null; mod null;
@ -34,15 +34,11 @@ pub trait Renderer: Sized {
/// ///
/// If you are implementing a graphical renderer, your output will most /// If you are implementing a graphical renderer, your output will most
/// likely be a tree of visual primitives. /// likely be a tree of visual primitives.
///
/// [`Renderer`]: trait.Renderer.html
type Output; type Output;
/// The default styling attributes of the [`Renderer`]. /// The default styling attributes of the [`Renderer`].
/// ///
/// This type can be leveraged to implement style inheritance. /// This type can be leveraged to implement style inheritance.
///
/// [`Renderer`]: trait.Renderer.html
type Defaults: Default; type Defaults: Default;
/// Lays out the elements of a user interface. /// Lays out the elements of a user interface.

View File

@ -13,8 +13,6 @@ pub struct Null;
impl Null { impl Null {
/// Creates a new [`Null`] renderer. /// Creates a new [`Null`] renderer.
///
/// [`Null`]: struct.Null.html
pub fn new() -> Null { pub fn new() -> Null {
Null Null
} }

View File

@ -7,8 +7,8 @@ use crate::Hasher;
/// It can be used by shells to easily spawn a [`Command`] or track a /// It can be used by shells to easily spawn a [`Command`] or track a
/// [`Subscription`]. /// [`Subscription`].
/// ///
/// [`Command`]: ../struct.Command.html /// [`Command`]: crate::Command
/// [`Subscription`]: ../struct.Subscription.html /// [`Subscription`]: crate::Subscription
pub type Runtime<Executor, Receiver, Message> = iced_futures::Runtime< pub type Runtime<Executor, Receiver, Message> = iced_futures::Runtime<
Hasher, Hasher,
(Event, event::Status), (Event, event::Status),

View File

@ -14,21 +14,16 @@ use iced_futures::futures::stream::BoxStream;
/// 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`]: ../struct.Command.html /// [`Command`]: crate::Command
/// [`Subscription`]: struct.Subscription.html
pub type Subscription<T> = pub type Subscription<T> =
iced_futures::Subscription<Hasher, (Event, event::Status), T>; iced_futures::Subscription<Hasher, (Event, event::Status), T>;
/// A stream of runtime events. /// A stream of runtime events.
/// ///
/// It is the input of a [`Subscription`] in the native runtime. /// It is the input of a [`Subscription`] in the native runtime.
///
/// [`Subscription`]: type.Subscription.html
pub type EventStream = BoxStream<'static, (Event, event::Status)>; pub type EventStream = BoxStream<'static, (Event, event::Status)>;
/// A native [`Subscription`] tracker. /// A native [`Subscription`] tracker.
///
/// [`Subscription`]: type.Subscription.html
pub type Tracker = pub type Tracker =
iced_futures::subscription::Tracker<Hasher, (Event, event::Status)>; iced_futures::subscription::Tracker<Hasher, (Event, event::Status)>;
@ -42,9 +37,6 @@ use events::Events;
/// ///
/// This subscription will notify your application of any [`Event`] that was /// This subscription will notify your application of any [`Event`] that was
/// not captured by any widget. /// not captured by any widget.
///
/// [`Subscription`]: type.Subscription.html
/// [`Event`]: ../enum.Event.html
pub fn events() -> Subscription<Event> { pub fn events() -> Subscription<Event> {
Subscription::from_recipe(Events { Subscription::from_recipe(Events {
f: |event, status| match status { f: |event, status| match status {
@ -62,9 +54,6 @@ pub fn events() -> Subscription<Event> {
/// ///
/// - Returns `None`, the [`Event`] will be discarded. /// - Returns `None`, the [`Event`] will be discarded.
/// - Returns `Some` message, the `Message` will be produced. /// - Returns `Some` message, the `Message` will be produced.
///
/// [`Subscription`]: type.Subscription.html
/// [`Event`]: ../enum.Event.html
pub fn events_with<Message>( pub fn events_with<Message>(
f: fn(Event, event::Status) -> Option<Message>, f: fn(Event, event::Status) -> Option<Message>,
) -> Subscription<Message> ) -> Subscription<Message>

View File

@ -12,14 +12,11 @@ use std::hash::Hasher;
/// Iced tries to avoid dictating how to write your event loop. You are in /// Iced tries to avoid dictating how to write your event loop. You are in
/// charge of using this type in your system in any way you want. /// charge of using this type in your system in any way you want.
/// ///
/// [`Layout`]: struct.Layout.html
///
/// # Example /// # Example
/// The [`integration` example] uses a [`UserInterface`] to integrate Iced in /// The [`integration` example] uses a [`UserInterface`] to integrate Iced in
/// an existing graphical application. /// an existing graphical application.
/// ///
/// [`integration` example]: https://github.com/hecrj/iced/tree/0.1/examples/integration /// [`integration` example]: https://github.com/hecrj/iced/tree/0.1/examples/integration
/// [`UserInterface`]: struct.UserInterface.html
#[allow(missing_debug_implementations)] #[allow(missing_debug_implementations)]
pub struct UserInterface<'a, Message, Renderer> { pub struct UserInterface<'a, Message, Renderer> {
root: Element<'a, Message, Renderer>, root: Element<'a, Message, Renderer>,
@ -37,10 +34,6 @@ where
/// It is able to avoid expensive computations when using a [`Cache`] /// It is able to avoid expensive computations when using a [`Cache`]
/// obtained from a previous instance of a [`UserInterface`]. /// obtained from a previous instance of a [`UserInterface`].
/// ///
/// [`Element`]: struct.Element.html
/// [`Cache`]: struct.Cache.html
/// [`UserInterface`]: struct.UserInterface.html
///
/// # Example /// # Example
/// Imagine we want to build a [`UserInterface`] for /// Imagine we want to build a [`UserInterface`] for
/// [the counter example that we previously wrote](index.html#usage). Here /// [the counter example that we previously wrote](index.html#usage). Here
@ -136,9 +129,6 @@ where
/// It returns __messages__ that may have been produced as a result of user /// It returns __messages__ that may have been produced as a result of user
/// interactions. You should feed these to your __update logic__. /// interactions. You should feed these to your __update logic__.
/// ///
/// [`UserInterface`]: struct.UserInterface.html
/// [`Event`]: enum.Event.html
///
/// # Example /// # Example
/// Let's allow our [counter](index.html#usage) to change state by /// Let's allow our [counter](index.html#usage) to change state by
/// completing [the previous example](#example): /// completing [the previous example](#example):
@ -268,12 +258,11 @@ where
/// Draws the [`UserInterface`] with the provided [`Renderer`]. /// Draws the [`UserInterface`] with the provided [`Renderer`].
/// ///
/// It returns the current state of the [`MouseCursor`]. You should update /// It returns the some [`Renderer::Output`]. You should update the icon of
/// the icon of the mouse cursor accordingly in your system. /// the mouse cursor accordingly in your system.
/// ///
/// [`UserInterface`]: struct.UserInterface.html /// [`Renderer`]: crate::Renderer
/// [`Renderer`]: trait.Renderer.html /// [`Renderer::Output`]: crate::Renderer::Output
/// [`MouseCursor`]: enum.MouseCursor.html
/// ///
/// # Example /// # Example
/// We can finally draw our [counter](index.html#usage) by /// We can finally draw our [counter](index.html#usage) by
@ -404,8 +393,6 @@ where
/// Relayouts and returns a new [`UserInterface`] using the provided /// Relayouts and returns a new [`UserInterface`] using the provided
/// bounds. /// bounds.
///
/// [`UserInterface`]: struct.UserInterface.html
pub fn relayout(self, bounds: Size, renderer: &mut Renderer) -> Self { pub fn relayout(self, bounds: Size, renderer: &mut Renderer) -> Self {
Self::build( Self::build(
self.root, self.root,
@ -421,9 +408,6 @@ where
/// Extract the [`Cache`] of the [`UserInterface`], consuming it in the /// Extract the [`Cache`] of the [`UserInterface`], consuming it in the
/// process. /// process.
///
/// [`Cache`]: struct.Cache.html
/// [`UserInterface`]: struct.UserInterface.html
pub fn into_cache(self) -> Cache { pub fn into_cache(self) -> Cache {
Cache { Cache {
base: self.base, base: self.base,
@ -464,8 +448,6 @@ struct Layer {
} }
/// Reusable data of a specific [`UserInterface`]. /// Reusable data of a specific [`UserInterface`].
///
/// [`UserInterface`]: struct.UserInterface.html
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Cache { pub struct Cache {
base: Layer, base: Layer,
@ -478,9 +460,6 @@ impl Cache {
/// ///
/// You should use this to initialize a [`Cache`] before building your first /// You should use this to initialize a [`Cache`] before building your first
/// [`UserInterface`]. /// [`UserInterface`].
///
/// [`Cache`]: struct.Cache.html
/// [`UserInterface`]: struct.UserInterface.html
pub fn new() -> Cache { pub fn new() -> Cache {
Cache { Cache {
base: Layer { base: Layer {

View File

@ -18,8 +18,7 @@
//! use iced_native::{button, Button, Widget}; //! use iced_native::{button, Button, Widget};
//! ``` //! ```
//! //!
//! [`Widget`]: trait.Widget.html //! [renderer]: crate::renderer
//! [renderer]: ../renderer/index.html
pub mod button; pub mod button;
pub mod checkbox; pub mod checkbox;
pub mod column; pub mod column;
@ -83,9 +82,6 @@ use crate::{Clipboard, Hasher, Layout, Length, Point, Rectangle};
/// If you want to build your own widgets, you will need to implement this /// If you want to build your own widgets, you will need to implement this
/// trait. /// trait.
/// ///
/// [`Widget`]: trait.Widget.html
/// [`Element`]: ../struct.Element.html
///
/// # Examples /// # Examples
/// The repository has some [examples] showcasing how to implement a custom /// The repository has some [examples] showcasing how to implement a custom
/// widget: /// widget:
@ -108,13 +104,9 @@ where
Renderer: crate::Renderer, Renderer: crate::Renderer,
{ {
/// Returns the width of the [`Widget`]. /// Returns the width of the [`Widget`].
///
/// [`Widget`]: trait.Widget.html
fn width(&self) -> Length; fn width(&self) -> Length;
/// Returns the height of the [`Widget`]. /// Returns the height of the [`Widget`].
///
/// [`Widget`]: trait.Widget.html
fn height(&self) -> Length; fn height(&self) -> Length;
/// Returns the [`Node`] of the [`Widget`]. /// Returns the [`Node`] of the [`Widget`].
@ -122,9 +114,7 @@ where
/// This [`Node`] is used by the runtime to compute the [`Layout`] of the /// This [`Node`] is used by the runtime to compute the [`Layout`] of the
/// user interface. /// user interface.
/// ///
/// [`Node`]: ../layout/struct.Node.html /// [`Node`]: layout::Node
/// [`Widget`]: trait.Widget.html
/// [`Layout`]: ../layout/struct.Layout.html
fn layout( fn layout(
&self, &self,
renderer: &Renderer, renderer: &Renderer,
@ -132,8 +122,6 @@ where
) -> layout::Node; ) -> layout::Node;
/// Draws the [`Widget`] using the associated `Renderer`. /// Draws the [`Widget`] using the associated `Renderer`.
///
/// [`Widget`]: trait.Widget.html
fn draw( fn draw(
&self, &self,
renderer: &mut Renderer, renderer: &mut Renderer,
@ -153,9 +141,7 @@ where
/// For example, the [`Text`] widget does not hash its color property, as /// For example, the [`Text`] widget does not hash its color property, as
/// its value cannot affect the overall [`Layout`] of the user interface. /// its value cannot affect the overall [`Layout`] of the user interface.
/// ///
/// [`Widget`]: trait.Widget.html /// [`Text`]: crate::widget::Text
/// [`Layout`]: ../layout/struct.Layout.html
/// [`Text`]: text/struct.Text.html
fn hash_layout(&self, state: &mut Hasher); fn hash_layout(&self, state: &mut Hasher);
/// Processes a runtime [`Event`]. /// Processes a runtime [`Event`].
@ -170,11 +156,6 @@ where
/// * a [`Clipboard`], if available /// * a [`Clipboard`], if available
/// ///
/// By default, it does nothing. /// By default, it does nothing.
///
/// [`Event`]: ../enum.Event.html
/// [`Widget`]: trait.Widget.html
/// [`Layout`]: ../layout/struct.Layout.html
/// [`Clipboard`]: ../trait.Clipboard.html
fn on_event( fn on_event(
&mut self, &mut self,
_event: Event, _event: Event,
@ -187,9 +168,7 @@ where
event::Status::Ignored event::Status::Ignored
} }
/// Returns the overlay of the [`Element`], if there is any. /// Returns the overlay of the [`Widget`], if there is any.
///
/// [`Element`]: struct.Element.html
fn overlay( fn overlay(
&mut self, &mut self,
_layout: Layout<'_>, _layout: Layout<'_>,

View File

@ -1,9 +1,6 @@
//! Allow your users to perform actions by pressing a button. //! Allow your users to perform actions by pressing a button.
//! //!
//! A [`Button`] has some local [`State`]. //! A [`Button`] has some local [`State`].
//!
//! [`Button`]: struct.Button.html
//! [`State`]: struct.State.html
use crate::event::{self, Event}; use crate::event::{self, Event};
use crate::layout; use crate::layout;
use crate::mouse; use crate::mouse;
@ -49,9 +46,6 @@ where
{ {
/// Creates a new [`Button`] with some local [`State`] and the given /// Creates a new [`Button`] with some local [`State`] and the given
/// content. /// content.
///
/// [`Button`]: struct.Button.html
/// [`State`]: struct.State.html
pub fn new<E>(state: &'a mut State, content: E) -> Self pub fn new<E>(state: &'a mut State, content: E) -> Self
where where
E: Into<Element<'a, Message, Renderer>>, E: Into<Element<'a, Message, Renderer>>,
@ -70,56 +64,42 @@ where
} }
/// Sets the width of the [`Button`]. /// Sets the width of the [`Button`].
///
/// [`Button`]: struct.Button.html
pub fn width(mut self, width: Length) -> Self { pub fn width(mut self, width: Length) -> Self {
self.width = width; self.width = width;
self self
} }
/// Sets the height of the [`Button`]. /// Sets the height of the [`Button`].
///
/// [`Button`]: struct.Button.html
pub fn height(mut self, height: Length) -> Self { pub fn height(mut self, height: Length) -> Self {
self.height = height; self.height = height;
self self
} }
/// Sets the minimum width of the [`Button`]. /// Sets the minimum width of the [`Button`].
///
/// [`Button`]: struct.Button.html
pub fn min_width(mut self, min_width: u32) -> Self { pub fn min_width(mut self, min_width: u32) -> Self {
self.min_width = min_width; self.min_width = min_width;
self self
} }
/// Sets the minimum height of the [`Button`]. /// Sets the minimum height of the [`Button`].
///
/// [`Button`]: struct.Button.html
pub fn min_height(mut self, min_height: u32) -> Self { pub fn min_height(mut self, min_height: u32) -> Self {
self.min_height = min_height; self.min_height = min_height;
self self
} }
/// Sets the padding of the [`Button`]. /// Sets the padding of the [`Button`].
///
/// [`Button`]: struct.Button.html
pub fn padding(mut self, padding: u16) -> Self { pub fn padding(mut self, padding: u16) -> Self {
self.padding = padding; self.padding = padding;
self self
} }
/// Sets the message that will be produced when the [`Button`] is pressed. /// Sets the message that will be produced when the [`Button`] is pressed.
///
/// [`Button`]: struct.Button.html
pub fn on_press(mut self, msg: Message) -> Self { pub fn on_press(mut self, msg: Message) -> Self {
self.on_press = Some(msg); self.on_press = Some(msg);
self self
} }
/// Sets the style of the [`Button`]. /// Sets the style of the [`Button`].
///
/// [`Button`]: struct.Button.html
pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self {
self.style = style.into(); self.style = style.into();
self self
@ -127,8 +107,6 @@ where
} }
/// The local state of a [`Button`]. /// The local state of a [`Button`].
///
/// [`Button`]: struct.Button.html
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct State { pub struct State {
is_pressed: bool, is_pressed: bool,
@ -136,8 +114,6 @@ pub struct State {
impl State { impl State {
/// Creates a new [`State`]. /// Creates a new [`State`].
///
/// [`State`]: struct.State.html
pub fn new() -> State { pub fn new() -> State {
State::default() State::default()
} }
@ -254,20 +230,15 @@ where
/// Your [renderer] will need to implement this trait before being /// Your [renderer] will need to implement this trait before being
/// able to use a [`Button`] in your user interface. /// able to use a [`Button`] in your user interface.
/// ///
/// [`Button`]: struct.Button.html /// [renderer]: crate::renderer
/// [renderer]: ../../renderer/index.html
pub trait Renderer: crate::Renderer + Sized { pub trait Renderer: crate::Renderer + Sized {
/// The default padding of a [`Button`]. /// The default padding of a [`Button`].
///
/// [`Button`]: struct.Button.html
const DEFAULT_PADDING: u16; const DEFAULT_PADDING: u16;
/// The style supported by this renderer. /// The style supported by this renderer.
type Style: Default; type Style: Default;
/// Draws a [`Button`]. /// Draws a [`Button`].
///
/// [`Button`]: struct.Button.html
fn draw<Message>( fn draw<Message>(
&mut self, &mut self,
defaults: &Self::Defaults, defaults: &Self::Defaults,

View File

@ -52,8 +52,6 @@ impl<Message, Renderer: self::Renderer + text::Renderer>
/// * a function that will be called when the [`Checkbox`] is toggled. It /// * a function that will be called when the [`Checkbox`] is toggled. It
/// will receive the new state of the [`Checkbox`] and must produce a /// will receive the new state of the [`Checkbox`] and must produce a
/// `Message`. /// `Message`.
///
/// [`Checkbox`]: struct.Checkbox.html
pub fn new<F>(is_checked: bool, label: impl Into<String>, f: F) -> Self pub fn new<F>(is_checked: bool, label: impl Into<String>, f: F) -> Self
where where
F: 'static + Fn(bool) -> Message, F: 'static + Fn(bool) -> Message,
@ -72,32 +70,24 @@ impl<Message, Renderer: self::Renderer + text::Renderer>
} }
/// Sets the size of the [`Checkbox`]. /// Sets the size of the [`Checkbox`].
///
/// [`Checkbox`]: struct.Checkbox.html
pub fn size(mut self, size: u16) -> Self { pub fn size(mut self, size: u16) -> Self {
self.size = size; self.size = size;
self self
} }
/// Sets the width of the [`Checkbox`]. /// Sets the width of the [`Checkbox`].
///
/// [`Checkbox`]: struct.Checkbox.html
pub fn width(mut self, width: Length) -> Self { pub fn width(mut self, width: Length) -> Self {
self.width = width; self.width = width;
self self
} }
/// Sets the spacing between the [`Checkbox`] and the text. /// Sets the spacing between the [`Checkbox`] and the text.
///
/// [`Checkbox`]: struct.Checkbox.html
pub fn spacing(mut self, spacing: u16) -> Self { pub fn spacing(mut self, spacing: u16) -> Self {
self.spacing = spacing; self.spacing = spacing;
self self
} }
/// Sets the text size of the [`Checkbox`]. /// Sets the text size of the [`Checkbox`].
///
/// [`Checkbox`]: struct.Checkbox.html
pub fn text_size(mut self, text_size: u16) -> Self { pub fn text_size(mut self, text_size: u16) -> Self {
self.text_size = Some(text_size); self.text_size = Some(text_size);
self self
@ -105,16 +95,13 @@ impl<Message, Renderer: self::Renderer + text::Renderer>
/// Sets the [`Font`] of the text of the [`Checkbox`]. /// Sets the [`Font`] of the text of the [`Checkbox`].
/// ///
/// [`Checkbox`]: struct.Checkbox.html /// [`Font`]: crate::widget::text::Renderer::Font
/// [`Font`]: ../../struct.Font.html
pub fn font(mut self, font: Renderer::Font) -> Self { pub fn font(mut self, font: Renderer::Font) -> Self {
self.font = font; self.font = font;
self self
} }
/// Sets the style of the [`Checkbox`]. /// Sets the style of the [`Checkbox`].
///
/// [`Checkbox`]: struct.Checkbox.html
pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self {
self.style = style.into(); self.style = style.into();
self self
@ -234,20 +221,15 @@ where
/// Your [renderer] will need to implement this trait before being /// Your [renderer] will need to implement this trait before being
/// able to use a [`Checkbox`] in your user interface. /// able to use a [`Checkbox`] in your user interface.
/// ///
/// [`Checkbox`]: struct.Checkbox.html /// [renderer]: crate::Renderer
/// [renderer]: ../../renderer/index.html
pub trait Renderer: crate::Renderer { pub trait Renderer: crate::Renderer {
/// The style supported by this renderer. /// The style supported by this renderer.
type Style: Default; type Style: Default;
/// The default size of a [`Checkbox`]. /// The default size of a [`Checkbox`].
///
/// [`Checkbox`]: struct.Checkbox.html
const DEFAULT_SIZE: u16; const DEFAULT_SIZE: u16;
/// The default spacing of a [`Checkbox`]. /// The default spacing of a [`Checkbox`].
///
/// [`Checkbox`]: struct.Checkbox.html
const DEFAULT_SPACING: u16; const DEFAULT_SPACING: u16;
/// Draws a [`Checkbox`]. /// Draws a [`Checkbox`].
@ -257,8 +239,6 @@ pub trait Renderer: crate::Renderer {
/// * whether the [`Checkbox`] is selected or not /// * whether the [`Checkbox`] is selected or not
/// * whether the mouse is over the [`Checkbox`] or not /// * whether the mouse is over the [`Checkbox`] or not
/// * the drawn label of the [`Checkbox`] /// * the drawn label of the [`Checkbox`]
///
/// [`Checkbox`]: struct.Checkbox.html
fn draw( fn draw(
&mut self, &mut self,
bounds: Rectangle, bounds: Rectangle,

View File

@ -25,15 +25,11 @@ pub struct Column<'a, Message, Renderer> {
impl<'a, Message, Renderer> Column<'a, Message, Renderer> { impl<'a, Message, Renderer> Column<'a, Message, Renderer> {
/// Creates an empty [`Column`]. /// Creates an empty [`Column`].
///
/// [`Column`]: struct.Column.html
pub fn new() -> Self { pub fn new() -> Self {
Self::with_children(Vec::new()) Self::with_children(Vec::new())
} }
/// Creates a [`Column`] with the given elements. /// Creates a [`Column`] with the given elements.
///
/// [`Column`]: struct.Column.html
pub fn with_children( pub fn with_children(
children: Vec<Element<'a, Message, Renderer>>, children: Vec<Element<'a, Message, Renderer>>,
) -> Self { ) -> Self {
@ -60,56 +56,42 @@ impl<'a, Message, Renderer> Column<'a, Message, Renderer> {
} }
/// Sets the padding of the [`Column`]. /// Sets the padding of the [`Column`].
///
/// [`Column`]: struct.Column.html
pub fn padding(mut self, units: u16) -> Self { pub fn padding(mut self, units: u16) -> Self {
self.padding = units; self.padding = units;
self self
} }
/// Sets the width of the [`Column`]. /// Sets the width of the [`Column`].
///
/// [`Column`]: struct.Column.html
pub fn width(mut self, width: Length) -> Self { pub fn width(mut self, width: Length) -> Self {
self.width = width; self.width = width;
self self
} }
/// Sets the height of the [`Column`]. /// Sets the height of the [`Column`].
///
/// [`Column`]: struct.Column.html
pub fn height(mut self, height: Length) -> Self { pub fn height(mut self, height: Length) -> Self {
self.height = height; self.height = height;
self self
} }
/// Sets the maximum width of the [`Column`]. /// Sets the maximum width of the [`Column`].
///
/// [`Column`]: struct.Column.html
pub fn max_width(mut self, max_width: u32) -> Self { pub fn max_width(mut self, max_width: u32) -> Self {
self.max_width = max_width; self.max_width = max_width;
self self
} }
/// Sets the maximum height of the [`Column`] in pixels. /// Sets the maximum height of the [`Column`] in pixels.
///
/// [`Column`]: struct.Column.html
pub fn max_height(mut self, max_height: u32) -> Self { pub fn max_height(mut self, max_height: u32) -> Self {
self.max_height = max_height; self.max_height = max_height;
self self
} }
/// Sets the horizontal alignment of the contents of the [`Column`] . /// Sets the horizontal alignment of the contents of the [`Column`] .
///
/// [`Column`]: struct.Column.html
pub fn align_items(mut self, align: Align) -> Self { pub fn align_items(mut self, align: Align) -> Self {
self.align_items = align; self.align_items = align;
self self
} }
/// Adds an element to the [`Column`]. /// Adds an element to the [`Column`].
///
/// [`Column`]: struct.Column.html
pub fn push<E>(mut self, child: E) -> Self pub fn push<E>(mut self, child: E) -> Self
where where
E: Into<Element<'a, Message, Renderer>>, E: Into<Element<'a, Message, Renderer>>,
@ -230,8 +212,7 @@ where
/// Your [renderer] will need to implement this trait before being /// Your [renderer] will need to implement this trait before being
/// able to use a [`Column`] in your user interface. /// able to use a [`Column`] in your user interface.
/// ///
/// [`Column`]: struct.Column.html /// [renderer]: crate::renderer
/// [renderer]: ../../renderer/index.html
pub trait Renderer: crate::Renderer + Sized { pub trait Renderer: crate::Renderer + Sized {
/// Draws a [`Column`]. /// Draws a [`Column`].
/// ///
@ -239,9 +220,6 @@ pub trait Renderer: crate::Renderer + Sized {
/// - the children of the [`Column`] /// - the children of the [`Column`]
/// - the [`Layout`] of the [`Column`] and its children /// - the [`Layout`] of the [`Column`] and its children
/// - the cursor position /// - the cursor position
///
/// [`Column`]: struct.Column.html
/// [`Layout`]: ../layout/struct.Layout.html
fn draw<Message>( fn draw<Message>(
&mut self, &mut self,
defaults: &Self::Defaults, defaults: &Self::Defaults,

View File

@ -31,8 +31,6 @@ where
Renderer: self::Renderer, Renderer: self::Renderer,
{ {
/// Creates an empty [`Container`]. /// Creates an empty [`Container`].
///
/// [`Container`]: struct.Container.html
pub fn new<T>(content: T) -> Self pub fn new<T>(content: T) -> Self
where where
T: Into<Element<'a, Message, Renderer>>, T: Into<Element<'a, Message, Renderer>>,
@ -51,80 +49,60 @@ where
} }
/// Sets the padding of the [`Container`]. /// Sets the padding of the [`Container`].
///
/// [`Container`]: struct.Column.html
pub fn padding(mut self, units: u16) -> Self { pub fn padding(mut self, units: u16) -> Self {
self.padding = units; self.padding = units;
self self
} }
/// Sets the width of the [`Container`]. /// Sets the width of the [`Container`].
///
/// [`Container`]: struct.Container.html
pub fn width(mut self, width: Length) -> Self { pub fn width(mut self, width: Length) -> Self {
self.width = width; self.width = width;
self self
} }
/// Sets the height of the [`Container`]. /// Sets the height of the [`Container`].
///
/// [`Container`]: struct.Container.html
pub fn height(mut self, height: Length) -> Self { pub fn height(mut self, height: Length) -> Self {
self.height = height; self.height = height;
self self
} }
/// Sets the maximum width of the [`Container`]. /// Sets the maximum width of the [`Container`].
///
/// [`Container`]: struct.Container.html
pub fn max_width(mut self, max_width: u32) -> Self { pub fn max_width(mut self, max_width: u32) -> Self {
self.max_width = max_width; self.max_width = max_width;
self self
} }
/// Sets the maximum height of the [`Container`] in pixels. /// Sets the maximum height of the [`Container`] in pixels.
///
/// [`Container`]: struct.Container.html
pub fn max_height(mut self, max_height: u32) -> Self { pub fn max_height(mut self, max_height: u32) -> Self {
self.max_height = max_height; self.max_height = max_height;
self self
} }
/// Sets the content alignment for the horizontal axis of the [`Container`]. /// Sets the content alignment for the horizontal axis of the [`Container`].
///
/// [`Container`]: struct.Container.html
pub fn align_x(mut self, alignment: Align) -> Self { pub fn align_x(mut self, alignment: Align) -> Self {
self.horizontal_alignment = alignment; self.horizontal_alignment = alignment;
self self
} }
/// Sets the content alignment for the vertical axis of the [`Container`]. /// Sets the content alignment for the vertical axis of the [`Container`].
///
/// [`Container`]: struct.Container.html
pub fn align_y(mut self, alignment: Align) -> Self { pub fn align_y(mut self, alignment: Align) -> Self {
self.vertical_alignment = alignment; self.vertical_alignment = alignment;
self self
} }
/// Centers the contents in the horizontal axis of the [`Container`]. /// Centers the contents in the horizontal axis of the [`Container`].
///
/// [`Container`]: struct.Container.html
pub fn center_x(mut self) -> Self { pub fn center_x(mut self) -> Self {
self.horizontal_alignment = Align::Center; self.horizontal_alignment = Align::Center;
self self
} }
/// Centers the contents in the vertical axis of the [`Container`]. /// Centers the contents in the vertical axis of the [`Container`].
///
/// [`Container`]: struct.Container.html
pub fn center_y(mut self) -> Self { pub fn center_y(mut self) -> Self {
self.vertical_alignment = Align::Center; self.vertical_alignment = Align::Center;
self self
} }
/// Sets the style of the [`Container`]. /// Sets the style of the [`Container`].
///
/// [`Container`]: struct.Container.html
pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self {
self.style = style.into(); self.style = style.into();
self self
@ -232,15 +210,12 @@ where
/// Your [renderer] will need to implement this trait before being /// Your [renderer] will need to implement this trait before being
/// able to use a [`Container`] in your user interface. /// able to use a [`Container`] in your user interface.
/// ///
/// [`Container`]: struct.Container.html /// [renderer]: crate::renderer
/// [renderer]: ../../renderer/index.html
pub trait Renderer: crate::Renderer { pub trait Renderer: crate::Renderer {
/// The style supported by this renderer. /// The style supported by this renderer.
type Style: Default; type Style: Default;
/// Draws a [`Container`]. /// Draws a [`Container`].
///
/// [`Container`]: struct.Container.html
fn draw<Message>( fn draw<Message>(
&mut self, &mut self,
defaults: &Self::Defaults, defaults: &Self::Defaults,

View File

@ -28,8 +28,6 @@ pub struct Image {
impl Image { impl Image {
/// Creates a new [`Image`] with the given path. /// Creates a new [`Image`] with the given path.
///
/// [`Image`]: struct.Image.html
pub fn new<T: Into<Handle>>(handle: T) -> Self { pub fn new<T: Into<Handle>>(handle: T) -> Self {
Image { Image {
handle: handle.into(), handle: handle.into(),
@ -39,16 +37,12 @@ impl Image {
} }
/// Sets the width of the [`Image`] boundaries. /// Sets the width of the [`Image`] boundaries.
///
/// [`Image`]: struct.Image.html
pub fn width(mut self, width: Length) -> Self { pub fn width(mut self, width: Length) -> Self {
self.width = width; self.width = width;
self self
} }
/// Sets the height of the [`Image`] boundaries. /// Sets the height of the [`Image`] boundaries.
///
/// [`Image`]: struct.Image.html
pub fn height(mut self, height: Length) -> Self { pub fn height(mut self, height: Length) -> Self {
self.height = height; self.height = height;
self self
@ -114,8 +108,6 @@ where
} }
/// An [`Image`] handle. /// An [`Image`] handle.
///
/// [`Image`]: struct.Image.html
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Handle { pub struct Handle {
id: u64, id: u64,
@ -126,8 +118,6 @@ impl Handle {
/// Creates an image [`Handle`] pointing to the image of the given path. /// Creates an image [`Handle`] pointing to the image of the given path.
/// ///
/// Makes an educated guess about the image format by examining the data in the file. /// Makes an educated guess about the image format by examining the data in the file.
///
/// [`Handle`]: struct.Handle.html
pub fn from_path<T: Into<PathBuf>>(path: T) -> Handle { pub fn from_path<T: Into<PathBuf>>(path: T) -> Handle {
Self::from_data(Data::Path(path.into())) Self::from_data(Data::Path(path.into()))
} }
@ -137,8 +127,6 @@ impl Handle {
/// pixels. /// pixels.
/// ///
/// This is useful if you have already decoded your image. /// This is useful if you have already decoded your image.
///
/// [`Handle`]: struct.Handle.html
pub fn from_pixels(width: u32, height: u32, pixels: Vec<u8>) -> Handle { pub fn from_pixels(width: u32, height: u32, pixels: Vec<u8>) -> Handle {
Self::from_data(Data::Pixels { Self::from_data(Data::Pixels {
width, width,
@ -153,8 +141,6 @@ impl Handle {
/// ///
/// This is useful if you already have your image loaded in-memory, maybe /// This is useful if you already have your image loaded in-memory, maybe
/// because you downloaded or generated it procedurally. /// because you downloaded or generated it procedurally.
///
/// [`Handle`]: struct.Handle.html
pub fn from_memory(bytes: Vec<u8>) -> Handle { pub fn from_memory(bytes: Vec<u8>) -> Handle {
Self::from_data(Data::Bytes(bytes)) Self::from_data(Data::Bytes(bytes))
} }
@ -170,15 +156,11 @@ impl Handle {
} }
/// Returns the unique identifier of the [`Handle`]. /// Returns the unique identifier of the [`Handle`].
///
/// [`Handle`]: struct.Handle.html
pub fn id(&self) -> u64 { pub fn id(&self) -> u64 {
self.id self.id
} }
/// Returns a reference to the image [`Data`]. /// Returns a reference to the image [`Data`].
///
/// [`Data`]: enum.Data.html
pub fn data(&self) -> &Data { pub fn data(&self) -> &Data {
&self.data &self.data
} }
@ -200,8 +182,6 @@ impl Hash for Handle {
} }
/// The data of an [`Image`]. /// The data of an [`Image`].
///
/// [`Image`]: struct.Image.html
#[derive(Clone, Hash)] #[derive(Clone, Hash)]
pub enum Data { pub enum Data {
/// File data /// File data
@ -238,17 +218,12 @@ impl std::fmt::Debug for Data {
/// Your [renderer] will need to implement this trait before being able to use /// Your [renderer] will need to implement this trait before being able to use
/// an [`Image`] in your user interface. /// an [`Image`] in your user interface.
/// ///
/// [`Image`]: struct.Image.html /// [renderer]: crate::renderer
/// [renderer]: ../../renderer/index.html
pub trait Renderer: crate::Renderer { pub trait Renderer: crate::Renderer {
/// Returns the dimensions of an [`Image`] located on the given path. /// Returns the dimensions of an [`Image`] located on the given path.
///
/// [`Image`]: struct.Image.html
fn dimensions(&self, handle: &Handle) -> (u32, u32); fn dimensions(&self, handle: &Handle) -> (u32, u32);
/// Draws an [`Image`]. /// Draws an [`Image`].
///
/// [`Image`]: struct.Image.html
fn draw(&mut self, handle: Handle, layout: Layout<'_>) -> Self::Output; fn draw(&mut self, handle: Handle, layout: Layout<'_>) -> Self::Output;
} }

View File

@ -6,8 +6,7 @@
//! The [`pane_grid` example] showcases how to use a [`PaneGrid`] with resizing, //! The [`pane_grid` example] showcases how to use a [`PaneGrid`] with resizing,
//! drag and drop, and hotkey support. //! drag and drop, and hotkey support.
//! //!
//! [`pane_grid` example]: https://github.com/hecrj/iced/tree/0.1/examples/pane_grid //! [`pane_grid` example]: https://github.com/hecrj/iced/tree/0.2/examples/pane_grid
//! [`PaneGrid`]: struct.PaneGrid.html
mod axis; mod axis;
mod configuration; mod configuration;
mod content; mod content;
@ -89,9 +88,6 @@ use crate::{
/// .on_drag(Message::PaneDragged) /// .on_drag(Message::PaneDragged)
/// .on_resize(10, Message::PaneResized); /// .on_resize(10, Message::PaneResized);
/// ``` /// ```
///
/// [`PaneGrid`]: struct.PaneGrid.html
/// [`State`]: struct.State.html
#[allow(missing_debug_implementations)] #[allow(missing_debug_implementations)]
pub struct PaneGrid<'a, Message, Renderer: self::Renderer> { pub struct PaneGrid<'a, Message, Renderer: self::Renderer> {
state: &'a mut state::Internal, state: &'a mut state::Internal,
@ -112,10 +108,6 @@ where
/// ///
/// The view function will be called to display each [`Pane`] present in the /// The view function will be called to display each [`Pane`] present in the
/// [`State`]. /// [`State`].
///
/// [`PaneGrid`]: struct.PaneGrid.html
/// [`State`]: struct.State.html
/// [`Pane`]: struct.Pane.html
pub fn new<T>( pub fn new<T>(
state: &'a mut State<T>, state: &'a mut State<T>,
view: impl Fn(Pane, &'a mut T) -> Content<'a, Message, Renderer>, view: impl Fn(Pane, &'a mut T) -> Content<'a, Message, Renderer>,
@ -141,24 +133,18 @@ where
} }
/// Sets the width of the [`PaneGrid`]. /// Sets the width of the [`PaneGrid`].
///
/// [`PaneGrid`]: struct.PaneGrid.html
pub fn width(mut self, width: Length) -> Self { pub fn width(mut self, width: Length) -> Self {
self.width = width; self.width = width;
self self
} }
/// Sets the height of the [`PaneGrid`]. /// Sets the height of the [`PaneGrid`].
///
/// [`PaneGrid`]: struct.PaneGrid.html
pub fn height(mut self, height: Length) -> Self { pub fn height(mut self, height: Length) -> Self {
self.height = height; self.height = height;
self self
} }
/// Sets the spacing _between_ the panes of the [`PaneGrid`]. /// Sets the spacing _between_ the panes of the [`PaneGrid`].
///
/// [`PaneGrid`]: struct.PaneGrid.html
pub fn spacing(mut self, units: u16) -> Self { pub fn spacing(mut self, units: u16) -> Self {
self.spacing = units; self.spacing = units;
self self
@ -166,9 +152,6 @@ where
/// Sets the message that will be produced when a [`Pane`] of the /// Sets the message that will be produced when a [`Pane`] of the
/// [`PaneGrid`] is clicked. /// [`PaneGrid`] is clicked.
///
/// [`Pane`]: struct.Pane.html
/// [`PaneGrid`]: struct.PaneGrid.html
pub fn on_click<F>(mut self, f: F) -> Self pub fn on_click<F>(mut self, f: F) -> Self
where where
F: 'a + Fn(Pane) -> Message, F: 'a + Fn(Pane) -> Message,
@ -179,8 +162,6 @@ where
/// Enables the drag and drop interactions of the [`PaneGrid`], which will /// Enables the drag and drop interactions of the [`PaneGrid`], which will
/// use the provided function to produce messages. /// use the provided function to produce messages.
///
/// [`PaneGrid`]: struct.PaneGrid.html
pub fn on_drag<F>(mut self, f: F) -> Self pub fn on_drag<F>(mut self, f: F) -> Self
where where
F: 'a + Fn(DragEvent) -> Message, F: 'a + Fn(DragEvent) -> Message,
@ -198,8 +179,6 @@ where
/// The grabbable area of a split will have a length of `spacing + leeway`, /// The grabbable area of a split will have a length of `spacing + leeway`,
/// properly centered. In other words, a length of /// properly centered. In other words, a length of
/// `(spacing + leeway) / 2.0` on either side of the split line. /// `(spacing + leeway) / 2.0` on either side of the split line.
///
/// [`PaneGrid`]: struct.PaneGrid.html
pub fn on_resize<F>(mut self, leeway: u16, f: F) -> Self pub fn on_resize<F>(mut self, leeway: u16, f: F) -> Self
where where
F: 'a + Fn(ResizeEvent) -> Message, F: 'a + Fn(ResizeEvent) -> Message,
@ -287,63 +266,41 @@ where
} }
/// An event produced during a drag and drop interaction of a [`PaneGrid`]. /// An event produced during a drag and drop interaction of a [`PaneGrid`].
///
/// [`PaneGrid`]: struct.PaneGrid.html
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub enum DragEvent { pub enum DragEvent {
/// A [`Pane`] was picked for dragging. /// A [`Pane`] was picked for dragging.
///
/// [`Pane`]: struct.Pane.html
Picked { Picked {
/// The picked [`Pane`]. /// The picked [`Pane`].
///
/// [`Pane`]: struct.Pane.html
pane: Pane, pane: Pane,
}, },
/// A [`Pane`] was dropped on top of another [`Pane`]. /// A [`Pane`] was dropped on top of another [`Pane`].
///
/// [`Pane`]: struct.Pane.html
Dropped { Dropped {
/// The picked [`Pane`]. /// The picked [`Pane`].
///
/// [`Pane`]: struct.Pane.html
pane: Pane, pane: Pane,
/// The [`Pane`] where the picked one was dropped on. /// The [`Pane`] where the picked one was dropped on.
///
/// [`Pane`]: struct.Pane.html
target: Pane, target: Pane,
}, },
/// A [`Pane`] was picked and then dropped outside of other [`Pane`] /// A [`Pane`] was picked and then dropped outside of other [`Pane`]
/// boundaries. /// boundaries.
///
/// [`Pane`]: struct.Pane.html
Canceled { Canceled {
/// The picked [`Pane`]. /// The picked [`Pane`].
///
/// [`Pane`]: struct.Pane.html
pane: Pane, pane: Pane,
}, },
} }
/// An event produced during a resize interaction of a [`PaneGrid`]. /// An event produced during a resize interaction of a [`PaneGrid`].
///
/// [`PaneGrid`]: struct.PaneGrid.html
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub struct ResizeEvent { pub struct ResizeEvent {
/// The [`Split`] that is being dragged for resizing. /// The [`Split`] that is being dragged for resizing.
///
/// [`Split`]: struct.Split.html
pub split: Split, pub split: Split,
/// The new ratio of the [`Split`]. /// The new ratio of the [`Split`].
/// ///
/// The ratio is a value in [0, 1], representing the exact position of a /// The ratio is a value in [0, 1], representing the exact position of a
/// [`Split`] between two panes. /// [`Split`] between two panes.
///
/// [`Split`]: struct.Split.html
pub ratio: f32, pub ratio: f32,
} }
@ -585,8 +542,7 @@ where
/// Your [renderer] will need to implement this trait before being /// Your [renderer] will need to implement this trait before being
/// able to use a [`PaneGrid`] in your user interface. /// able to use a [`PaneGrid`] in your user interface.
/// ///
/// [`PaneGrid`]: struct.PaneGrid.html /// [renderer]: crate::renderer
/// [renderer]: ../../renderer/index.html
pub trait Renderer: pub trait Renderer:
crate::Renderer + container::Renderer + text::Renderer + Sized crate::Renderer + container::Renderer + text::Renderer + Sized
{ {
@ -598,10 +554,6 @@ pub trait Renderer:
/// - the [`Axis`] that is currently being resized /// - the [`Axis`] that is currently being resized
/// - the [`Layout`] of the [`PaneGrid`] and its elements /// - the [`Layout`] of the [`PaneGrid`] and its elements
/// - the cursor position /// - the cursor position
///
/// [`PaneGrid`]: struct.PaneGrid.html
/// [`Pane`]: struct.Pane.html
/// [`Layout`]: ../layout/struct.Layout.html
fn draw<Message>( fn draw<Message>(
&mut self, &mut self,
defaults: &Self::Defaults, defaults: &Self::Defaults,
@ -619,9 +571,6 @@ pub trait Renderer:
/// - the [`Content`] of the [`Pane`] /// - the [`Content`] of the [`Pane`]
/// - the [`Layout`] of the [`Pane`] and its elements /// - the [`Layout`] of the [`Pane`] and its elements
/// - the cursor position /// - the cursor position
///
/// [`Pane`]: struct.Pane.html
/// [`Layout`]: ../layout/struct.Layout.html
fn draw_pane<Message>( fn draw_pane<Message>(
&mut self, &mut self,
defaults: &Self::Defaults, defaults: &Self::Defaults,
@ -640,9 +589,6 @@ pub trait Renderer:
/// - the title of the [`TitleBar`] with its size, font, and bounds /// - the title of the [`TitleBar`] with its size, font, and bounds
/// - the controls of the [`TitleBar`] with their [`Layout`+, if any /// - the controls of the [`TitleBar`] with their [`Layout`+, if any
/// - the cursor position /// - the cursor position
///
/// [`TitleBar`]: struct.TitleBar.html
/// [`Layout`]: ../layout/struct.Layout.html
fn draw_title_bar<Message>( fn draw_title_bar<Message>(
&mut self, &mut self,
defaults: &Self::Defaults, defaults: &Self::Defaults,

View File

@ -7,7 +7,7 @@ use crate::{Clipboard, Element, Hasher, Layout, Point, Size};
/// The content of a [`Pane`]. /// The content of a [`Pane`].
/// ///
/// [`Pane`]: struct.Pane.html /// [`Pane`]: crate::widget::pane_grid::Pane
#[allow(missing_debug_implementations)] #[allow(missing_debug_implementations)]
pub struct Content<'a, Message, Renderer: pane_grid::Renderer> { pub struct Content<'a, Message, Renderer: pane_grid::Renderer> {
title_bar: Option<TitleBar<'a, Message, Renderer>>, title_bar: Option<TitleBar<'a, Message, Renderer>>,
@ -20,8 +20,6 @@ where
Renderer: pane_grid::Renderer, Renderer: pane_grid::Renderer,
{ {
/// Creates a new [`Content`] with the provided body. /// Creates a new [`Content`] with the provided body.
///
/// [`Content`]: struct.Content.html
pub fn new(body: impl Into<Element<'a, Message, Renderer>>) -> Self { pub fn new(body: impl Into<Element<'a, Message, Renderer>>) -> Self {
Self { Self {
title_bar: None, title_bar: None,
@ -31,9 +29,6 @@ where
} }
/// Sets the [`TitleBar`] of this [`Content`]. /// Sets the [`TitleBar`] of this [`Content`].
///
/// [`TitleBar`]: struct.TitleBar.html
/// [`Content`]: struct.Content.html
pub fn title_bar( pub fn title_bar(
mut self, mut self,
title_bar: TitleBar<'a, Message, Renderer>, title_bar: TitleBar<'a, Message, Renderer>,
@ -43,8 +38,6 @@ where
} }
/// Sets the style of the [`Content`]. /// Sets the style of the [`Content`].
///
/// [`Content`]: struct.Content.html
pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self {
self.style = style.into(); self.style = style.into();
self self
@ -57,9 +50,7 @@ where
{ {
/// Draws the [`Content`] with the provided [`Renderer`] and [`Layout`]. /// Draws the [`Content`] with the provided [`Renderer`] and [`Layout`].
/// ///
/// [`Content`]: struct.Content.html /// [`Renderer`]: crate::widget::pane_grid::Renderer
/// [`Renderer`]: trait.Renderer.html
/// [`Layout`]: ../layout/struct.Layout.html
pub fn draw( pub fn draw(
&self, &self,
renderer: &mut Renderer, renderer: &mut Renderer,
@ -94,9 +85,6 @@ where
/// Returns whether the [`Content`] with the given [`Layout`] can be picked /// Returns whether the [`Content`] with the given [`Layout`] can be picked
/// at the provided cursor position. /// at the provided cursor position.
///
/// [`Content`]: struct.Content.html
/// [`Layout`]: ../layout/struct.Layout.html
pub fn can_be_picked_at( pub fn can_be_picked_at(
&self, &self,
layout: Layout<'_>, layout: Layout<'_>,

View File

@ -7,17 +7,12 @@ use std::collections::HashMap;
/// A layout node of a [`PaneGrid`]. /// A layout node of a [`PaneGrid`].
/// ///
/// [`PaneGrid`]: struct.PaneGrid.html /// [`PaneGrid`]: crate::widget::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.
///
/// [`Node`]: enum.Node.html
Split { Split {
/// The [`Split`] of this [`Node`]. /// The [`Split`] of this [`Node`].
///
/// [`Split`]: struct.Split.html
/// [`Node`]: enum.Node.html
id: Split, id: Split,
/// The direction of the split. /// The direction of the split.
@ -27,26 +22,17 @@ pub enum Node {
ratio: f32, ratio: f32,
/// The left/top [`Node`] of the split. /// The left/top [`Node`] of the split.
///
/// [`Node`]: enum.Node.html
a: Box<Node>, a: Box<Node>,
/// The right/bottom [`Node`] of the split. /// The right/bottom [`Node`] of the split.
///
/// [`Node`]: enum.Node.html
b: Box<Node>, b: Box<Node>,
}, },
/// The region of this [`Node`] is taken by a [`Pane`]. /// The region of this [`Node`] is taken by a [`Pane`].
///
/// [`Pane`]: struct.Pane.html
Pane(Pane), Pane(Pane),
} }
impl Node { impl Node {
/// Returns an iterator over each [`Split`] in this [`Node`]. /// Returns an iterator over each [`Split`] in this [`Node`].
///
/// [`Split`]: struct.Split.html
/// [`Node`]: enum.Node.html
pub fn splits(&self) -> impl Iterator<Item = &Split> { pub fn splits(&self) -> impl Iterator<Item = &Split> {
let mut unvisited_nodes = vec![self]; let mut unvisited_nodes = vec![self];
@ -69,9 +55,6 @@ impl Node {
/// Returns the rectangular region for each [`Pane`] in the [`Node`] given /// Returns the rectangular region for each [`Pane`] in the [`Node`] given
/// the spacing between panes and the total available space. /// the spacing between panes and the total available space.
///
/// [`Pane`]: struct.Pane.html
/// [`Node`]: enum.Node.html
pub fn pane_regions( pub fn pane_regions(
&self, &self,
spacing: f32, spacing: f32,
@ -96,9 +79,6 @@ impl Node {
/// Returns the axis, rectangular region, and ratio for each [`Split`] in /// Returns the axis, rectangular region, and ratio for each [`Split`] in
/// the [`Node`] given the spacing between panes and the total available /// the [`Node`] given the spacing between panes and the total available
/// space. /// space.
///
/// [`Split`]: struct.Split.html
/// [`Node`]: enum.Node.html
pub fn split_regions( pub fn split_regions(
&self, &self,
spacing: f32, spacing: f32,

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`]: struct.PaneGrid.html /// [`PaneGrid`]: crate::widget::PaneGrid
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, 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`]: struct.PaneGrid.html /// [`PaneGrid`]: crate::widget::PaneGrid
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Split(pub(super) usize); pub struct Split(pub(super) usize);

View File

@ -15,11 +15,8 @@ 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`]: struct.PaneGrid.html /// [`PaneGrid`]: crate::widget::PaneGrid
/// [`PaneGrid::new`]: struct.PaneGrid.html#method.new /// [`PaneGrid::new`]: crate::widget::PaneGrid::new
/// [`Pane`]: struct.Pane.html
/// [`Split`]: struct.Split.html
/// [`State`]: struct.State.html
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct State<T> { pub struct State<T> {
pub(super) panes: HashMap<Pane, T>, pub(super) panes: HashMap<Pane, T>,
@ -31,9 +28,6 @@ impl<T> State<T> {
/// state. /// state.
/// ///
/// Alongside the [`State`], it returns the first [`Pane`] identifier. /// Alongside the [`State`], it returns the first [`Pane`] identifier.
///
/// [`State`]: struct.State.html
/// [`Pane`]: struct.Pane.html
pub fn new(first_pane_state: T) -> (Self, Pane) { pub fn new(first_pane_state: T) -> (Self, Pane) {
( (
Self::with_configuration(Configuration::Pane(first_pane_state)), Self::with_configuration(Configuration::Pane(first_pane_state)),
@ -42,9 +36,6 @@ impl<T> State<T> {
} }
/// Creates a new [`State`] with the given [`Configuration`]. /// Creates a new [`State`] with the given [`Configuration`].
///
/// [`State`]: struct.State.html
/// [`Configuration`]: enum.Configuration.html
pub fn with_configuration(config: impl Into<Configuration<T>>) -> Self { pub fn with_configuration(config: impl Into<Configuration<T>>) -> Self {
let mut panes = HashMap::new(); let mut panes = HashMap::new();
@ -62,54 +53,40 @@ impl<T> State<T> {
} }
/// Returns the total amount of panes in the [`State`]. /// Returns the total amount of panes in the [`State`].
///
/// [`State`]: struct.State.html
pub fn len(&self) -> usize { pub fn len(&self) -> usize {
self.panes.len() self.panes.len()
} }
/// Returns the internal state of the given [`Pane`], if it exists. /// Returns the internal state of the given [`Pane`], if it exists.
///
/// [`Pane`]: struct.Pane.html
pub fn get(&self, pane: &Pane) -> Option<&T> { pub fn get(&self, pane: &Pane) -> Option<&T> {
self.panes.get(pane) self.panes.get(pane)
} }
/// Returns the internal state of the given [`Pane`] with mutability, if it /// Returns the internal state of the given [`Pane`] with mutability, if it
/// exists. /// exists.
///
/// [`Pane`]: struct.Pane.html
pub fn get_mut(&mut self, pane: &Pane) -> Option<&mut T> { pub fn get_mut(&mut self, pane: &Pane) -> Option<&mut T> {
self.panes.get_mut(pane) self.panes.get_mut(pane)
} }
/// Returns an iterator over all the panes of the [`State`], alongside its /// Returns an iterator over all the panes of the [`State`], alongside its
/// internal state. /// internal state.
///
/// [`State`]: struct.State.html
pub fn iter(&self) -> impl Iterator<Item = (&Pane, &T)> { pub fn iter(&self) -> impl Iterator<Item = (&Pane, &T)> {
self.panes.iter() self.panes.iter()
} }
/// Returns a mutable iterator over all the panes of the [`State`], /// Returns a mutable iterator over all the panes of the [`State`],
/// alongside its internal state. /// alongside its internal state.
///
/// [`State`]: struct.State.html
pub fn iter_mut(&mut self) -> impl Iterator<Item = (&Pane, &mut T)> { pub fn iter_mut(&mut self) -> impl Iterator<Item = (&Pane, &mut T)> {
self.panes.iter_mut() self.panes.iter_mut()
} }
/// Returns the layout of the [`State`]. /// Returns the layout of the [`State`].
///
/// [`State`]: struct.State.html
pub fn layout(&self) -> &Node { pub fn layout(&self) -> &Node {
&self.internal.layout &self.internal.layout
} }
/// Returns the adjacent [`Pane`] of another [`Pane`] in the given /// Returns the adjacent [`Pane`] of another [`Pane`] in the given
/// direction, if there is one. /// direction, if there is one.
///
/// [`Pane`]: struct.Pane.html
pub fn adjacent(&self, pane: &Pane, direction: Direction) -> Option<Pane> { pub fn adjacent(&self, pane: &Pane, direction: Direction) -> Option<Pane> {
let regions = self let regions = self
.internal .internal
@ -145,9 +122,6 @@ impl<T> State<T> {
/// Splits the given [`Pane`] into two in the given [`Axis`] and /// Splits the given [`Pane`] into two in the given [`Axis`] and
/// initializing the new [`Pane`] with the provided internal state. /// initializing the new [`Pane`] with the provided internal state.
///
/// [`Pane`]: struct.Pane.html
/// [`Axis`]: enum.Axis.html
pub fn split( pub fn split(
&mut self, &mut self,
axis: Axis, axis: Axis,
@ -180,9 +154,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`].
/// ///
/// [`State`]: struct.State.html /// [`PaneGrid`]: crate::widget::PaneGrid
/// [`PaneGrid`]: struct.PaneGrid.html /// [`DragEvent`]: crate::widget::pane_grid::DragEvent
/// [`DragEvent`]: struct.DragEvent.html
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 { .. } => {}
@ -204,17 +177,14 @@ 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`].
/// ///
/// [`Split`]: struct.Split.html /// [`PaneGrid`]: crate::widget::PaneGrid
/// [`PaneGrid`]: struct.PaneGrid.html /// [`ResizeEvent`]: crate::widget::pane_grid::ResizeEvent
/// [`ResizeEvent`]: struct.ResizeEvent.html
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);
} }
/// Closes the given [`Pane`] and returns its internal state and its closest /// Closes the given [`Pane`] and returns its internal state and its closest
/// sibling, if it exists. /// sibling, if it exists.
///
/// [`Pane`]: struct.Pane.html
pub fn close(&mut self, pane: &Pane) -> Option<(T, Pane)> { pub fn close(&mut self, pane: &Pane) -> Option<(T, Pane)> {
if let Some(sibling) = self.internal.layout.remove(pane) { if let Some(sibling) = self.internal.layout.remove(pane) {
self.panes.remove(pane).map(|state| (state, sibling)) self.panes.remove(pane).map(|state| (state, sibling))

View File

@ -5,7 +5,7 @@ use crate::{Clipboard, Element, Hasher, Layout, Point, Rectangle, Size};
/// The title bar of a [`Pane`]. /// The title bar of a [`Pane`].
/// ///
/// [`Pane`]: struct.Pane.html /// [`Pane`]: crate::widget::pane_grid::Pane
#[allow(missing_debug_implementations)] #[allow(missing_debug_implementations)]
pub struct TitleBar<'a, Message, Renderer: pane_grid::Renderer> { pub struct TitleBar<'a, Message, Renderer: pane_grid::Renderer> {
title: String, title: String,
@ -21,8 +21,6 @@ where
Renderer: pane_grid::Renderer, Renderer: pane_grid::Renderer,
{ {
/// Creates a new [`TitleBar`] with the given title. /// Creates a new [`TitleBar`] with the given title.
///
/// [`TitleBar`]: struct.TitleBar.html
pub fn new(title: impl Into<String>) -> Self { pub fn new(title: impl Into<String>) -> Self {
Self { Self {
title: title.into(), title: title.into(),
@ -35,16 +33,12 @@ where
} }
/// Sets the size of the title of the [`TitleBar`]. /// Sets the size of the title of the [`TitleBar`].
///
/// [`TitleBar`]: struct.TitleBar.html
pub fn title_size(mut self, size: u16) -> Self { pub fn title_size(mut self, size: u16) -> Self {
self.title_size = Some(size); self.title_size = Some(size);
self self
} }
/// Sets the controls of the [`TitleBar`]. /// Sets the controls of the [`TitleBar`].
///
/// [`TitleBar`]: struct.TitleBar.html
pub fn controls( pub fn controls(
mut self, mut self,
controls: impl Into<Element<'a, Message, Renderer>>, controls: impl Into<Element<'a, Message, Renderer>>,
@ -54,16 +48,12 @@ where
} }
/// Sets the padding of the [`TitleBar`]. /// Sets the padding of the [`TitleBar`].
///
/// [`TitleBar`]: struct.TitleBar.html
pub fn padding(mut self, units: u16) -> Self { pub fn padding(mut self, units: u16) -> Self {
self.padding = units; self.padding = units;
self self
} }
/// Sets the style of the [`TitleBar`]. /// Sets the style of the [`TitleBar`].
///
/// [`TitleBar`]: struct.TitleBar.html
pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self {
self.style = style.into(); self.style = style.into();
self self
@ -75,9 +65,8 @@ where
/// By default, the controls are only visible when the [`Pane`] of this /// By default, the controls are only visible when the [`Pane`] of this
/// [`TitleBar`] is hovered. /// [`TitleBar`] is hovered.
/// ///
/// [`TitleBar`]: struct.TitleBar.html /// [`controls`]: Self::controls
/// [`controls`]: struct.TitleBar.html#method.controls /// [`Pane`]: crate::widget::pane_grid::Pane
/// [`Pane`]: struct.Pane.html
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
@ -90,9 +79,7 @@ where
{ {
/// Draws the [`TitleBar`] with the provided [`Renderer`] and [`Layout`]. /// Draws the [`TitleBar`] with the provided [`Renderer`] and [`Layout`].
/// ///
/// [`TitleBar`]: struct.TitleBar.html /// [`Renderer`]: crate::widget::pane_grid::Renderer
/// [`Renderer`]: trait.Renderer.html
/// [`Layout`]: ../layout/struct.Layout.html
pub fn draw( pub fn draw(
&self, &self,
renderer: &mut Renderer, renderer: &mut Renderer,
@ -152,8 +139,6 @@ where
/// [`TitleBar`] or not. /// [`TitleBar`] or not.
/// ///
/// The whole [`TitleBar`] is a pick area, except its controls. /// The whole [`TitleBar`] is a pick area, except its controls.
///
/// [`TitleBar`]: struct.TitleBar.html
pub fn is_over_pick_area( pub fn is_over_pick_area(
&self, &self,
layout: Layout<'_>, layout: Layout<'_>,

View File

@ -32,8 +32,6 @@ where
} }
/// The local state of a [`PickList`]. /// The local state of a [`PickList`].
///
/// [`PickList`]: struct.PickList.html
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct State<T> { pub struct State<T> {
menu: menu::State, menu: menu::State,
@ -62,9 +60,6 @@ where
/// Creates a new [`PickList`] with the given [`State`], a list of options, /// Creates a new [`PickList`] with the given [`State`], a list of options,
/// the current selected value, and the message to produce when an option is /// the current selected value, and the message to produce when an option is
/// selected. /// selected.
///
/// [`PickList`]: struct.PickList.html
/// [`State`]: struct.State.html
pub fn new( pub fn new(
state: &'a mut State<T>, state: &'a mut State<T>,
options: impl Into<Cow<'a, [T]>>, options: impl Into<Cow<'a, [T]>>,
@ -95,40 +90,30 @@ where
} }
/// Sets the width of the [`PickList`]. /// Sets the width of the [`PickList`].
///
/// [`PickList`]: struct.PickList.html
pub fn width(mut self, width: Length) -> Self { pub fn width(mut self, width: Length) -> Self {
self.width = width; self.width = width;
self self
} }
/// Sets the padding of the [`PickList`]. /// Sets the padding of the [`PickList`].
///
/// [`PickList`]: struct.PickList.html
pub fn padding(mut self, padding: u16) -> Self { pub fn padding(mut self, padding: u16) -> Self {
self.padding = padding; self.padding = padding;
self self
} }
/// Sets the text size of the [`PickList`]. /// Sets the text size of the [`PickList`].
///
/// [`PickList`]: struct.PickList.html
pub fn text_size(mut self, size: u16) -> Self { pub fn text_size(mut self, size: u16) -> Self {
self.text_size = Some(size); self.text_size = Some(size);
self self
} }
/// Sets the font of the [`PickList`]. /// Sets the font of the [`PickList`].
///
/// [`PickList`]: struct.PickList.html
pub fn font(mut self, font: Renderer::Font) -> Self { pub fn font(mut self, font: Renderer::Font) -> Self {
self.font = font; self.font = font;
self self
} }
/// Sets the style of the [`PickList`]. /// Sets the style of the [`PickList`].
///
/// [`PickList`]: struct.PickList.html
pub fn style( pub fn style(
mut self, mut self,
style: impl Into<<Renderer as self::Renderer>::Style>, style: impl Into<<Renderer as self::Renderer>::Style>,
@ -318,30 +303,20 @@ where
/// Your [renderer] will need to implement this trait before being /// Your [renderer] will need to implement this trait before being
/// able to use a [`PickList`] in your user interface. /// able to use a [`PickList`] in your user interface.
/// ///
/// [`PickList`]: struct.PickList.html /// [renderer]: crate::renderer
/// [renderer]: ../../renderer/index.html
pub trait Renderer: text::Renderer + menu::Renderer { pub trait Renderer: text::Renderer + menu::Renderer {
/// The default padding of a [`PickList`]. /// The default padding of a [`PickList`].
///
/// [`PickList`]: struct.PickList.html
const DEFAULT_PADDING: u16; const DEFAULT_PADDING: u16;
/// The [`PickList`] style supported by this renderer. /// The [`PickList`] style supported by this renderer.
///
/// [`PickList`]: struct.PickList.html
type Style: Default; type Style: Default;
/// Returns the style of the [`Menu`] of the [`PickList`]. /// Returns the style of the [`Menu`] of the [`PickList`].
///
/// [`Menu`]: ../../overlay/menu/struct.Menu.html
/// [`PickList`]: struct.PickList.html
fn menu_style( fn menu_style(
style: &<Self as Renderer>::Style, style: &<Self as Renderer>::Style,
) -> <Self as menu::Renderer>::Style; ) -> <Self as menu::Renderer>::Style;
/// Draws a [`PickList`]. /// Draws a [`PickList`].
///
/// [`PickList`]: struct.PickList.html
fn draw( fn draw(
&mut self, &mut self,
bounds: Rectangle, bounds: Rectangle,

View File

@ -33,8 +33,6 @@ impl<Renderer: self::Renderer> ProgressBar<Renderer> {
/// It expects: /// It expects:
/// * an inclusive range of possible values /// * an inclusive range of possible values
/// * the current value of the [`ProgressBar`] /// * the current value of the [`ProgressBar`]
///
/// [`ProgressBar`]: struct.ProgressBar.html
pub fn new(range: RangeInclusive<f32>, value: f32) -> Self { pub fn new(range: RangeInclusive<f32>, value: f32) -> Self {
ProgressBar { ProgressBar {
value: value.max(*range.start()).min(*range.end()), value: value.max(*range.start()).min(*range.end()),
@ -46,24 +44,18 @@ impl<Renderer: self::Renderer> ProgressBar<Renderer> {
} }
/// Sets the width of the [`ProgressBar`]. /// Sets the width of the [`ProgressBar`].
///
/// [`ProgressBar`]: struct.ProgressBar.html
pub fn width(mut self, width: Length) -> Self { pub fn width(mut self, width: Length) -> Self {
self.width = width; self.width = width;
self self
} }
/// Sets the height of the [`ProgressBar`]. /// Sets the height of the [`ProgressBar`].
///
/// [`ProgressBar`]: struct.ProgressBar.html
pub fn height(mut self, height: Length) -> Self { pub fn height(mut self, height: Length) -> Self {
self.height = Some(height); self.height = Some(height);
self self
} }
/// Sets the style of the [`ProgressBar`]. /// Sets the style of the [`ProgressBar`].
///
/// [`ProgressBar`]: struct.ProgressBar.html
pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self {
self.style = style.into(); self.style = style.into();
self self
@ -128,15 +120,12 @@ where
/// Your [renderer] will need to implement this trait before being /// Your [renderer] will need to implement this trait before being
/// able to use a [`ProgressBar`] in your user interface. /// able to use a [`ProgressBar`] in your user interface.
/// ///
/// [`ProgressBar`]: struct.ProgressBar.html /// [renderer]: crate::renderer
/// [renderer]: ../../renderer/index.html
pub trait Renderer: crate::Renderer { pub trait Renderer: crate::Renderer {
/// The style supported by this renderer. /// The style supported by this renderer.
type Style: Default; type Style: Default;
/// The default height of a [`ProgressBar`]. /// The default height of a [`ProgressBar`].
///
/// [`ProgressBar`]: struct.ProgressBar.html
const DEFAULT_HEIGHT: u16; const DEFAULT_HEIGHT: u16;
/// Draws a [`ProgressBar`]. /// Draws a [`ProgressBar`].
@ -147,8 +136,6 @@ pub trait Renderer: crate::Renderer {
/// * the current value of the [`ProgressBar`] /// * the current value of the [`ProgressBar`]
/// * maybe a specific background of the [`ProgressBar`] /// * maybe a specific background of the [`ProgressBar`]
/// * maybe a specific active color of the [`ProgressBar`] /// * maybe a specific active color of the [`ProgressBar`]
///
/// [`ProgressBar`]: struct.ProgressBar.html
fn draw( fn draw(
&self, &self,
bounds: Rectangle, bounds: Rectangle,

View File

@ -62,8 +62,6 @@ where
/// * the current selected value /// * the current selected value
/// * a function that will be called when the [`Radio`] is selected. It /// * a function that will be called when the [`Radio`] is selected. It
/// receives the value of the radio and must produce a `Message`. /// receives the value of the radio and must produce a `Message`.
///
/// [`Radio`]: struct.Radio.html
pub fn new<F, V>( pub fn new<F, V>(
value: V, value: V,
label: impl Into<String>, label: impl Into<String>,
@ -87,40 +85,30 @@ where
} }
/// Sets the size of the [`Radio`] button. /// Sets the size of the [`Radio`] button.
///
/// [`Radio`]: struct.Radio.html
pub fn size(mut self, size: u16) -> Self { pub fn size(mut self, size: u16) -> Self {
self.size = size; self.size = size;
self self
} }
/// Sets the width of the [`Radio`] button. /// Sets the width of the [`Radio`] button.
///
/// [`Radio`]: struct.Radio.html
pub fn width(mut self, width: Length) -> Self { pub fn width(mut self, width: Length) -> Self {
self.width = width; self.width = width;
self self
} }
/// Sets the spacing between the [`Radio`] button and the text. /// Sets the spacing between the [`Radio`] button and the text.
///
/// [`Radio`]: struct.Radio.html
pub fn spacing(mut self, spacing: u16) -> Self { pub fn spacing(mut self, spacing: u16) -> Self {
self.spacing = spacing; self.spacing = spacing;
self self
} }
/// Sets the text size of the [`Radio`] button. /// Sets the text size of the [`Radio`] button.
///
/// [`Radio`]: struct.Radio.html
pub fn text_size(mut self, text_size: u16) -> Self { pub fn text_size(mut self, text_size: u16) -> Self {
self.text_size = Some(text_size); self.text_size = Some(text_size);
self self
} }
/// Sets the style of the [`Radio`] button. /// Sets the style of the [`Radio`] button.
///
/// [`Radio`]: struct.Radio.html
pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self {
self.style = style.into(); self.style = style.into();
self self
@ -237,20 +225,15 @@ where
/// Your [renderer] will need to implement this trait before being /// Your [renderer] will need to implement this trait before being
/// able to use a [`Radio`] button in your user interface. /// able to use a [`Radio`] button in your user interface.
/// ///
/// [`Radio`]: struct.Radio.html /// [renderer]: crate::renderer
/// [renderer]: ../../renderer/index.html
pub trait Renderer: crate::Renderer { pub trait Renderer: crate::Renderer {
/// The style supported by this renderer. /// The style supported by this renderer.
type Style: Default; type Style: Default;
/// The default size of a [`Radio`] button. /// The default size of a [`Radio`] button.
///
/// [`Radio`]: struct.Radio.html
const DEFAULT_SIZE: u16; const DEFAULT_SIZE: u16;
/// The default spacing of a [`Radio`] button. /// The default spacing of a [`Radio`] button.
///
/// [`Radio`]: struct.Radio.html
const DEFAULT_SPACING: u16; const DEFAULT_SPACING: u16;
/// Draws a [`Radio`] button. /// Draws a [`Radio`] button.
@ -260,8 +243,6 @@ pub trait Renderer: crate::Renderer {
/// * whether the [`Radio`] is selected or not /// * whether the [`Radio`] is selected or not
/// * whether the mouse is over the [`Radio`] or not /// * whether the mouse is over the [`Radio`] or not
/// * the drawn label of the [`Radio`] /// * the drawn label of the [`Radio`]
///
/// [`Radio`]: struct.Radio.html
fn draw( fn draw(
&mut self, &mut self,
bounds: Rectangle, bounds: Rectangle,

View File

@ -24,15 +24,11 @@ pub struct Row<'a, Message, Renderer> {
impl<'a, Message, Renderer> Row<'a, Message, Renderer> { impl<'a, Message, Renderer> Row<'a, Message, Renderer> {
/// Creates an empty [`Row`]. /// Creates an empty [`Row`].
///
/// [`Row`]: struct.Row.html
pub fn new() -> Self { pub fn new() -> Self {
Self::with_children(Vec::new()) Self::with_children(Vec::new())
} }
/// Creates a [`Row`] with the given elements. /// Creates a [`Row`] with the given elements.
///
/// [`Row`]: struct.Row.html
pub fn with_children( pub fn with_children(
children: Vec<Element<'a, Message, Renderer>>, children: Vec<Element<'a, Message, Renderer>>,
) -> Self { ) -> Self {
@ -59,57 +55,42 @@ impl<'a, Message, Renderer> Row<'a, Message, Renderer> {
} }
/// Sets the padding of the [`Row`]. /// Sets the padding of the [`Row`].
///
/// [`Row`]: struct.Row.html
pub fn padding(mut self, units: u16) -> Self { pub fn padding(mut self, units: u16) -> Self {
self.padding = units; self.padding = units;
self self
} }
/// Sets the width of the [`Row`]. /// Sets the width of the [`Row`].
///
/// [`Row`]: struct.Row.html
pub fn width(mut self, width: Length) -> Self { pub fn width(mut self, width: Length) -> Self {
self.width = width; self.width = width;
self self
} }
/// Sets the height of the [`Row`]. /// Sets the height of the [`Row`].
///
/// [`Row`]: struct.Row.html
pub fn height(mut self, height: Length) -> Self { pub fn height(mut self, height: Length) -> Self {
self.height = height; self.height = height;
self self
} }
/// Sets the maximum width of the [`Row`]. /// Sets the maximum width of the [`Row`].
///
/// [`Row`]: struct.Row.html
pub fn max_width(mut self, max_width: u32) -> Self { pub fn max_width(mut self, max_width: u32) -> Self {
self.max_width = max_width; self.max_width = max_width;
self self
} }
/// Sets the maximum height of the [`Row`]. /// Sets the maximum height of the [`Row`].
///
/// [`Row`]: struct.Row.html
pub fn max_height(mut self, max_height: u32) -> Self { pub fn max_height(mut self, max_height: u32) -> Self {
self.max_height = max_height; self.max_height = max_height;
self self
} }
/// Sets the vertical alignment of the contents of the [`Row`] . /// Sets the vertical alignment of the contents of the [`Row`] .
///
/// [`Row`]: struct.Row.html
pub fn align_items(mut self, align: Align) -> Self { pub fn align_items(mut self, align: Align) -> Self {
self.align_items = align; self.align_items = align;
self self
} }
/// Adds an [`Element`] to the [`Row`]. /// Adds an [`Element`] to the [`Row`].
///
/// [`Element`]: ../struct.Element.html
/// [`Row`]: struct.Row.html
pub fn push<E>(mut self, child: E) -> Self pub fn push<E>(mut self, child: E) -> Self
where where
E: Into<Element<'a, Message, Renderer>>, E: Into<Element<'a, Message, Renderer>>,
@ -230,8 +211,7 @@ where
/// Your [renderer] will need to implement this trait before being /// Your [renderer] will need to implement this trait before being
/// able to use a [`Row`] in your user interface. /// able to use a [`Row`] in your user interface.
/// ///
/// [`Row`]: struct.Row.html /// [renderer]: crate::renderer
/// [renderer]: ../../renderer/index.html
pub trait Renderer: crate::Renderer + Sized { pub trait Renderer: crate::Renderer + Sized {
/// Draws a [`Row`]. /// Draws a [`Row`].
/// ///
@ -239,9 +219,6 @@ pub trait Renderer: crate::Renderer + Sized {
/// - the children of the [`Row`] /// - the children of the [`Row`]
/// - the [`Layout`] of the [`Row`] and its children /// - the [`Layout`] of the [`Row`] and its children
/// - the cursor position /// - the cursor position
///
/// [`Row`]: struct.Row.html
/// [`Layout`]: ../layout/struct.Layout.html
fn draw<Message>( fn draw<Message>(
&mut self, &mut self,
defaults: &Self::Defaults, defaults: &Self::Defaults,

View File

@ -17,8 +17,6 @@ pub struct Rule<Renderer: self::Renderer> {
impl<Renderer: self::Renderer> Rule<Renderer> { impl<Renderer: self::Renderer> Rule<Renderer> {
/// Creates a horizontal [`Rule`] for dividing content by the given vertical spacing. /// Creates a horizontal [`Rule`] for dividing content by the given vertical spacing.
///
/// [`Rule`]: struct.Rule.html
pub fn horizontal(spacing: u16) -> Self { pub fn horizontal(spacing: u16) -> Self {
Rule { Rule {
width: Length::Fill, width: Length::Fill,
@ -29,8 +27,6 @@ impl<Renderer: self::Renderer> Rule<Renderer> {
} }
/// Creates a vertical [`Rule`] for dividing content by the given horizontal spacing. /// Creates a vertical [`Rule`] for dividing content by the given horizontal spacing.
///
/// [`Rule`]: struct.Rule.html
pub fn vertical(spacing: u16) -> Self { pub fn vertical(spacing: u16) -> Self {
Rule { Rule {
width: Length::from(Length::Units(spacing)), width: Length::from(Length::Units(spacing)),
@ -41,8 +37,6 @@ impl<Renderer: self::Renderer> Rule<Renderer> {
} }
/// Sets the style of the [`Rule`]. /// Sets the style of the [`Rule`].
///
/// [`Rule`]: struct.Rule.html
pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self {
self.style = style.into(); self.style = style.into();
self self
@ -92,8 +86,6 @@ where
} }
/// The renderer of a [`Rule`]. /// The renderer of a [`Rule`].
///
/// [`Rule`]: struct.Rule.html
pub trait Renderer: crate::Renderer { pub trait Renderer: crate::Renderer {
/// The style supported by this renderer. /// The style supported by this renderer.
type Style: Default; type Style: Default;
@ -104,8 +96,6 @@ pub trait Renderer: crate::Renderer {
/// * the bounds of the [`Rule`] /// * the bounds of the [`Rule`]
/// * the style of the [`Rule`] /// * the style of the [`Rule`]
/// * whether the [`Rule`] is horizontal (true) or vertical (false) /// * whether the [`Rule`] is horizontal (true) or vertical (false)
///
/// [`Rule`]: struct.Rule.html
fn draw( fn draw(
&mut self, &mut self,
bounds: Rectangle, bounds: Rectangle,

View File

@ -27,9 +27,6 @@ pub struct Scrollable<'a, Message, Renderer: self::Renderer> {
impl<'a, Message, Renderer: self::Renderer> Scrollable<'a, Message, Renderer> { impl<'a, Message, Renderer: self::Renderer> Scrollable<'a, Message, Renderer> {
/// Creates a new [`Scrollable`] with the given [`State`]. /// Creates a new [`Scrollable`] with the given [`State`].
///
/// [`Scrollable`]: struct.Scrollable.html
/// [`State`]: struct.State.html
pub fn new(state: &'a mut State) -> Self { pub fn new(state: &'a mut State) -> Self {
Scrollable { Scrollable {
state, state,
@ -54,48 +51,36 @@ impl<'a, Message, Renderer: self::Renderer> Scrollable<'a, Message, Renderer> {
} }
/// Sets the padding of the [`Scrollable`]. /// Sets the padding of the [`Scrollable`].
///
/// [`Scrollable`]: struct.Scrollable.html
pub fn padding(mut self, units: u16) -> Self { pub fn padding(mut self, units: u16) -> Self {
self.content = self.content.padding(units); self.content = self.content.padding(units);
self self
} }
/// Sets the width of the [`Scrollable`]. /// Sets the width of the [`Scrollable`].
///
/// [`Scrollable`]: struct.Scrollable.html
pub fn width(mut self, width: Length) -> Self { pub fn width(mut self, width: Length) -> Self {
self.content = self.content.width(width); self.content = self.content.width(width);
self self
} }
/// Sets the height of the [`Scrollable`]. /// Sets the height of the [`Scrollable`].
///
/// [`Scrollable`]: struct.Scrollable.html
pub fn height(mut self, height: Length) -> Self { pub fn height(mut self, height: Length) -> Self {
self.height = height; self.height = height;
self self
} }
/// Sets the maximum width of the [`Scrollable`]. /// Sets the maximum width of the [`Scrollable`].
///
/// [`Scrollable`]: struct.Scrollable.html
pub fn max_width(mut self, max_width: u32) -> Self { pub fn max_width(mut self, max_width: u32) -> Self {
self.content = self.content.max_width(max_width); self.content = self.content.max_width(max_width);
self self
} }
/// Sets the maximum height of the [`Scrollable`] in pixels. /// Sets the maximum height of the [`Scrollable`] in pixels.
///
/// [`Scrollable`]: struct.Scrollable.html
pub fn max_height(mut self, max_height: u32) -> Self { pub fn max_height(mut self, max_height: u32) -> Self {
self.max_height = max_height; self.max_height = max_height;
self self
} }
/// Sets the horizontal alignment of the contents of the [`Scrollable`] . /// Sets the horizontal alignment of the contents of the [`Scrollable`] .
///
/// [`Scrollable`]: struct.Scrollable.html
pub fn align_items(mut self, align_items: Align) -> Self { pub fn align_items(mut self, align_items: Align) -> Self {
self.content = self.content.align_items(align_items); self.content = self.content.align_items(align_items);
self self
@ -103,16 +88,12 @@ impl<'a, Message, Renderer: self::Renderer> Scrollable<'a, Message, Renderer> {
/// Sets the scrollbar width of the [`Scrollable`] . /// Sets the scrollbar width of the [`Scrollable`] .
/// Silently enforces a minimum value of 1. /// Silently enforces a minimum value of 1.
///
/// [`Scrollable`]: struct.Scrollable.html
pub fn scrollbar_width(mut self, scrollbar_width: u16) -> Self { pub fn scrollbar_width(mut self, scrollbar_width: u16) -> Self {
self.scrollbar_width = scrollbar_width.max(1); self.scrollbar_width = scrollbar_width.max(1);
self self
} }
/// Sets the scrollbar margin of the [`Scrollable`] . /// Sets the scrollbar margin of the [`Scrollable`] .
///
/// [`Scrollable`]: struct.Scrollable.html
pub fn scrollbar_margin(mut self, scrollbar_margin: u16) -> Self { pub fn scrollbar_margin(mut self, scrollbar_margin: u16) -> Self {
self.scrollbar_margin = scrollbar_margin; self.scrollbar_margin = scrollbar_margin;
self self
@ -120,24 +101,18 @@ impl<'a, Message, Renderer: self::Renderer> Scrollable<'a, Message, Renderer> {
/// Sets the scroller width of the [`Scrollable`] . /// Sets the scroller width of the [`Scrollable`] .
/// Silently enforces a minimum value of 1. /// Silently enforces a minimum value of 1.
///
/// [`Scrollable`]: struct.Scrollable.html
pub fn scroller_width(mut self, scroller_width: u16) -> Self { pub fn scroller_width(mut self, scroller_width: u16) -> Self {
self.scroller_width = scroller_width.max(1); self.scroller_width = scroller_width.max(1);
self self
} }
/// Sets the style of the [`Scrollable`] . /// Sets the style of the [`Scrollable`] .
///
/// [`Scrollable`]: struct.Scrollable.html
pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self {
self.style = style.into(); self.style = style.into();
self self
} }
/// Adds an element to the [`Scrollable`]. /// Adds an element to the [`Scrollable`].
///
/// [`Scrollable`]: struct.Scrollable.html
pub fn push<E>(mut self, child: E) -> Self pub fn push<E>(mut self, child: E) -> Self
where where
E: Into<Element<'a, Message, Renderer>>, E: Into<Element<'a, Message, Renderer>>,
@ -407,8 +382,6 @@ where
} }
/// The local state of a [`Scrollable`]. /// The local state of a [`Scrollable`].
///
/// [`Scrollable`]: struct.Scrollable.html
#[derive(Debug, Clone, Copy, Default)] #[derive(Debug, Clone, Copy, Default)]
pub struct State { pub struct State {
scroller_grabbed_at: Option<f32>, scroller_grabbed_at: Option<f32>,
@ -417,17 +390,12 @@ pub struct State {
impl State { impl State {
/// Creates a new [`State`] with the scrollbar located at the top. /// Creates a new [`State`] with the scrollbar located at the top.
///
/// [`State`]: struct.State.html
pub fn new() -> Self { pub fn new() -> Self {
State::default() State::default()
} }
/// Apply a scrolling offset to the current [`State`], given the bounds of /// Apply a scrolling offset to the current [`State`], given the bounds of
/// the [`Scrollable`] and its contents. /// the [`Scrollable`] and its contents.
///
/// [`Scrollable`]: struct.Scrollable.html
/// [`State`]: struct.State.html
pub fn scroll( pub fn scroll(
&mut self, &mut self,
delta_y: f32, delta_y: f32,
@ -448,9 +416,6 @@ impl State {
/// ///
/// `0` represents scrollbar at the top, while `1` represents scrollbar at /// `0` represents scrollbar at the top, while `1` represents scrollbar at
/// the bottom. /// the bottom.
///
/// [`Scrollable`]: struct.Scrollable.html
/// [`State`]: struct.State.html
pub fn scroll_to( pub fn scroll_to(
&mut self, &mut self,
percentage: f32, percentage: f32,
@ -463,9 +428,6 @@ impl State {
/// Returns the current scrolling offset of the [`State`], given the bounds /// Returns the current scrolling offset of the [`State`], given the bounds
/// of the [`Scrollable`] and its contents. /// of the [`Scrollable`] and its contents.
///
/// [`Scrollable`]: struct.Scrollable.html
/// [`State`]: struct.State.html
pub fn offset(&self, bounds: Rectangle, content_bounds: Rectangle) -> u32 { pub fn offset(&self, bounds: Rectangle, content_bounds: Rectangle) -> u32 {
let hidden_content = let hidden_content =
(content_bounds.height - bounds.height).max(0.0).round() as u32; (content_bounds.height - bounds.height).max(0.0).round() as u32;
@ -480,30 +442,19 @@ impl State {
} }
/// The scrollbar of a [`Scrollable`]. /// The scrollbar of a [`Scrollable`].
///
/// [`Scrollable`]: struct.Scrollable.html
#[derive(Debug)] #[derive(Debug)]
pub struct Scrollbar { pub struct Scrollbar {
/// The outer bounds of the scrollable, including the [`Scrollbar`] and /// The outer bounds of the scrollable, including the [`Scrollbar`] and
/// [`Scroller`]. /// [`Scroller`].
///
/// [`Scrollbar`]: struct.Scrollbar.html
/// [`Scroller`]: struct.Scroller.html
pub outer_bounds: Rectangle, pub outer_bounds: Rectangle,
/// The bounds of the [`Scrollbar`]. /// The bounds of the [`Scrollbar`].
///
/// [`Scrollbar`]: struct.Scrollbar.html
pub bounds: Rectangle, pub bounds: Rectangle,
/// The margin within the [`Scrollbar`]. /// The margin within the [`Scrollbar`].
///
/// [`Scrollbar`]: struct.Scrollbar.html
pub margin: u16, pub margin: u16,
/// The bounds of the [`Scroller`]. /// The bounds of the [`Scroller`].
///
/// [`Scroller`]: struct.Scroller.html
pub scroller: Scroller, pub scroller: Scroller,
} }
@ -538,13 +489,9 @@ impl Scrollbar {
} }
/// The handle of a [`Scrollbar`]. /// The handle of a [`Scrollbar`].
///
/// [`Scrollbar`]: struct.Scrollbar.html
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub struct Scroller { pub struct Scroller {
/// The bounds of the [`Scroller`]. /// The bounds of the [`Scroller`].
///
/// [`Scroller`]: struct.Scrollbar.html
pub bounds: Rectangle, pub bounds: Rectangle,
} }
@ -553,17 +500,13 @@ pub struct Scroller {
/// Your [renderer] will need to implement this trait before being /// Your [renderer] will need to implement this trait before being
/// able to use a [`Scrollable`] in your user interface. /// able to use a [`Scrollable`] in your user interface.
/// ///
/// [`Scrollable`]: struct.Scrollable.html /// [renderer]: crate::renderer
/// [renderer]: ../../renderer/index.html
pub trait Renderer: column::Renderer + Sized { pub trait Renderer: column::Renderer + Sized {
/// The style supported by this renderer. /// The style supported by this renderer.
type Style: Default; type Style: Default;
/// Returns the [`Scrollbar`] given the bounds and content bounds of a /// Returns the [`Scrollbar`] given the bounds and content bounds of a
/// [`Scrollable`]. /// [`Scrollable`].
///
/// [`Scrollbar`]: struct.Scrollbar.html
/// [`Scrollable`]: struct.Scrollable.html
fn scrollbar( fn scrollbar(
&self, &self,
bounds: Rectangle, bounds: Rectangle,
@ -585,10 +528,6 @@ pub trait Renderer: column::Renderer + Sized {
/// - a optional [`Scrollbar`] to be rendered /// - a optional [`Scrollbar`] to be rendered
/// - the scrolling offset /// - the scrolling offset
/// - the drawn content /// - the drawn content
///
/// [`Scrollbar`]: struct.Scrollbar.html
/// [`Scrollable`]: struct.Scrollable.html
/// [`State`]: struct.State.html
fn draw( fn draw(
&mut self, &mut self,
scrollable: &State, scrollable: &State,

View File

@ -1,9 +1,6 @@
//! Display an interactive selector of a single value from a range of values. //! Display an interactive selector of a single value from a range of values.
//! //!
//! A [`Slider`] has some local [`State`]. //! A [`Slider`] has some local [`State`].
//!
//! [`Slider`]: struct.Slider.html
//! [`State`]: struct.State.html
use crate::event::{self, Event}; use crate::event::{self, Event};
use crate::layout; use crate::layout;
use crate::mouse; use crate::mouse;
@ -21,8 +18,6 @@ use std::{hash::Hash, ops::RangeInclusive};
/// The [`Slider`] range of numeric values is generic and its step size defaults /// The [`Slider`] range of numeric values is generic and its step size defaults
/// to 1 unit. /// to 1 unit.
/// ///
/// [`Slider`]: struct.Slider.html
///
/// # Example /// # Example
/// ``` /// ```
/// # use iced_native::{slider, renderer::Null}; /// # use iced_native::{slider, renderer::Null};
@ -68,9 +63,6 @@ where
/// * a function that will be called when the [`Slider`] is dragged. /// * a function that will be called when the [`Slider`] is dragged.
/// It receives the new value of the [`Slider`] and must produce a /// It receives the new value of the [`Slider`] and must produce a
/// `Message`. /// `Message`.
///
/// [`Slider`]: struct.Slider.html
/// [`State`]: struct.State.html
pub fn new<F>( pub fn new<F>(
state: &'a mut State, state: &'a mut State,
range: RangeInclusive<T>, range: RangeInclusive<T>,
@ -111,40 +103,30 @@ where
/// Typically, the user's interaction with the slider is finished when this message is produced. /// Typically, the user's interaction with the slider is finished when this message is produced.
/// This is useful if you need to spawn a long-running task from the slider's result, where /// This is useful if you need to spawn a long-running task from the slider's result, where
/// the default on_change message could create too many events. /// the default on_change message could create too many events.
///
/// [`Slider`]: struct.Slider.html
pub fn on_release(mut self, on_release: Message) -> Self { pub fn on_release(mut self, on_release: Message) -> Self {
self.on_release = Some(on_release); self.on_release = Some(on_release);
self self
} }
/// Sets the width of the [`Slider`]. /// Sets the width of the [`Slider`].
///
/// [`Slider`]: struct.Slider.html
pub fn width(mut self, width: Length) -> Self { pub fn width(mut self, width: Length) -> Self {
self.width = width; self.width = width;
self self
} }
/// Sets the height of the [`Slider`]. /// Sets the height of the [`Slider`].
///
/// [`Slider`]: struct.Slider.html
pub fn height(mut self, height: u16) -> Self { pub fn height(mut self, height: u16) -> Self {
self.height = height; self.height = height;
self self
} }
/// Sets the style of the [`Slider`]. /// Sets the style of the [`Slider`].
///
/// [`Slider`]: struct.Slider.html
pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self {
self.style = style.into(); self.style = style.into();
self self
} }
/// Sets the step size of the [`Slider`]. /// Sets the step size of the [`Slider`].
///
/// [`Slider`]: struct.Slider.html
pub fn step(mut self, step: T) -> Self { pub fn step(mut self, step: T) -> Self {
self.step = step; self.step = step;
self self
@ -152,8 +134,6 @@ where
} }
/// The local state of a [`Slider`]. /// The local state of a [`Slider`].
///
/// [`Slider`]: struct.Slider.html
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct State { pub struct State {
is_dragging: bool, is_dragging: bool,
@ -161,8 +141,6 @@ pub struct State {
impl State { impl State {
/// Creates a new [`State`]. /// Creates a new [`State`].
///
/// [`State`]: struct.State.html
pub fn new() -> State { pub fn new() -> State {
State::default() State::default()
} }
@ -297,15 +275,12 @@ where
/// Your [renderer] will need to implement this trait before being /// Your [renderer] will need to implement this trait before being
/// able to use a [`Slider`] in your user interface. /// able to use a [`Slider`] in your user interface.
/// ///
/// [`Slider`]: struct.Slider.html /// [renderer]: crate::renderer
/// [renderer]: ../../renderer/index.html
pub trait Renderer: crate::Renderer { pub trait Renderer: crate::Renderer {
/// The style supported by this renderer. /// The style supported by this renderer.
type Style: Default; type Style: Default;
/// The default height of a [`Slider`]. /// The default height of a [`Slider`].
///
/// [`Slider`]: struct.Slider.html
const DEFAULT_HEIGHT: u16; const DEFAULT_HEIGHT: u16;
/// Draws a [`Slider`]. /// Draws a [`Slider`].
@ -316,10 +291,6 @@ pub trait Renderer: crate::Renderer {
/// * the local state of the [`Slider`] /// * the local state of the [`Slider`]
/// * the range of values of the [`Slider`] /// * the range of values of the [`Slider`]
/// * the current value of the [`Slider`] /// * the current value of the [`Slider`]
///
/// [`Slider`]: struct.Slider.html
/// [`State`]: struct.State.html
/// [`Class`]: enum.Class.html
fn draw( fn draw(
&mut self, &mut self,
bounds: Rectangle, bounds: Rectangle,

View File

@ -16,15 +16,11 @@ pub struct Space {
impl Space { impl Space {
/// Creates an amount of empty [`Space`] with the given width and height. /// Creates an amount of empty [`Space`] with the given width and height.
///
/// [`Space`]: struct.Space.html
pub fn new(width: Length, height: Length) -> Self { pub fn new(width: Length, height: Length) -> Self {
Space { width, height } Space { width, height }
} }
/// Creates an amount of horizontal [`Space`]. /// Creates an amount of horizontal [`Space`].
///
/// [`Space`]: struct.Space.html
pub fn with_width(width: Length) -> Self { pub fn with_width(width: Length) -> Self {
Space { Space {
width, width,
@ -33,8 +29,6 @@ impl Space {
} }
/// Creates an amount of vertical [`Space`]. /// Creates an amount of vertical [`Space`].
///
/// [`Space`]: struct.Space.html
pub fn with_height(height: Length) -> Self { pub fn with_height(height: Length) -> Self {
Space { Space {
width: Length::Shrink, width: Length::Shrink,
@ -85,14 +79,10 @@ where
} }
/// The renderer of an amount of [`Space`]. /// The renderer of an amount of [`Space`].
///
/// [`Space`]: struct.Space.html
pub trait Renderer: crate::Renderer { pub trait Renderer: crate::Renderer {
/// Draws an amount of empty [`Space`]. /// Draws an amount of empty [`Space`].
/// ///
/// You should most likely return an empty primitive here. /// You should most likely return an empty primitive here.
///
/// [`Space`]: struct.Space.html
fn draw(&mut self, bounds: Rectangle) -> Self::Output; fn draw(&mut self, bounds: Rectangle) -> Self::Output;
} }

View File

@ -14,8 +14,6 @@ use std::{
/// ///
/// [`Svg`] images can have a considerable rendering cost when resized, /// [`Svg`] images can have a considerable rendering cost when resized,
/// specially when they are complex. /// specially when they are complex.
///
/// [`Svg`]: struct.Svg.html
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Svg { pub struct Svg {
handle: Handle, handle: Handle,
@ -25,9 +23,6 @@ pub struct Svg {
impl Svg { impl Svg {
/// Creates a new [`Svg`] from the given [`Handle`]. /// Creates a new [`Svg`] from the given [`Handle`].
///
/// [`Svg`]: struct.Svg.html
/// [`Handle`]: struct.Handle.html
pub fn new(handle: impl Into<Handle>) -> Self { pub fn new(handle: impl Into<Handle>) -> Self {
Svg { Svg {
handle: handle.into(), handle: handle.into(),
@ -38,23 +33,17 @@ impl Svg {
/// Creates a new [`Svg`] that will display the contents of the file at the /// Creates a new [`Svg`] that will display the contents of the file at the
/// provided path. /// provided path.
///
/// [`Svg`]: struct.Svg.html
pub fn from_path(path: impl Into<PathBuf>) -> Self { pub fn from_path(path: impl Into<PathBuf>) -> Self {
Self::new(Handle::from_path(path)) Self::new(Handle::from_path(path))
} }
/// Sets the width of the [`Svg`]. /// Sets the width of the [`Svg`].
///
/// [`Svg`]: struct.Svg.html
pub fn width(mut self, width: Length) -> Self { pub fn width(mut self, width: Length) -> Self {
self.width = width; self.width = width;
self self
} }
/// Sets the height of the [`Svg`]. /// Sets the height of the [`Svg`].
///
/// [`Svg`]: struct.Svg.html
pub fn height(mut self, height: Length) -> Self { pub fn height(mut self, height: Length) -> Self {
self.height = height; self.height = height;
self self
@ -119,8 +108,6 @@ where
} }
/// An [`Svg`] handle. /// An [`Svg`] handle.
///
/// [`Svg`]: struct.Svg.html
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Handle { pub struct Handle {
id: u64, id: u64,
@ -130,8 +117,6 @@ pub struct Handle {
impl Handle { impl Handle {
/// Creates an SVG [`Handle`] pointing to the vector image of the given /// Creates an SVG [`Handle`] pointing to the vector image of the given
/// path. /// path.
///
/// [`Handle`]: struct.Handle.html
pub fn from_path(path: impl Into<PathBuf>) -> Handle { pub fn from_path(path: impl Into<PathBuf>) -> Handle {
Self::from_data(Data::Path(path.into())) Self::from_data(Data::Path(path.into()))
} }
@ -141,8 +126,6 @@ impl Handle {
/// ///
/// This is useful if you already have your SVG data in-memory, maybe /// This is useful if you already have your SVG data in-memory, maybe
/// because you downloaded or generated it procedurally. /// because you downloaded or generated it procedurally.
///
/// [`Handle`]: struct.Handle.html
pub fn from_memory(bytes: impl Into<Vec<u8>>) -> Handle { pub fn from_memory(bytes: impl Into<Vec<u8>>) -> Handle {
Self::from_data(Data::Bytes(bytes.into())) Self::from_data(Data::Bytes(bytes.into()))
} }
@ -158,15 +141,11 @@ impl Handle {
} }
/// Returns the unique identifier of the [`Handle`]. /// Returns the unique identifier of the [`Handle`].
///
/// [`Handle`]: struct.Handle.html
pub fn id(&self) -> u64 { pub fn id(&self) -> u64 {
self.id self.id
} }
/// Returns a reference to the SVG [`Data`]. /// Returns a reference to the SVG [`Data`].
///
/// [`Data`]: enum.Data.html
pub fn data(&self) -> &Data { pub fn data(&self) -> &Data {
&self.data &self.data
} }
@ -179,8 +158,6 @@ impl Hash for Handle {
} }
/// The data of an [`Svg`]. /// The data of an [`Svg`].
///
/// [`Svg`]: struct.Svg.html
#[derive(Clone, Hash)] #[derive(Clone, Hash)]
pub enum Data { pub enum Data {
/// File data /// File data
@ -206,18 +183,12 @@ impl std::fmt::Debug for Data {
/// Your [renderer] will need to implement this trait before being able to use /// Your [renderer] will need to implement this trait before being able to use
/// an [`Svg`] in your user interface. /// an [`Svg`] in your user interface.
/// ///
/// [`Svg`]: struct.Svg.html /// [renderer]: crate::renderer
/// [renderer]: ../../renderer/index.html
pub trait Renderer: crate::Renderer { pub trait Renderer: crate::Renderer {
/// Returns the default dimensions of an [`Svg`] for the given [`Handle`]. /// Returns the default dimensions of an [`Svg`] for the given [`Handle`].
///
/// [`Svg`]: struct.Svg.html
/// [`Handle`]: struct.Handle.html
fn dimensions(&self, handle: &Handle) -> (u32, u32); fn dimensions(&self, handle: &Handle) -> (u32, u32);
/// Draws an [`Svg`]. /// Draws an [`Svg`].
///
/// [`Svg`]: struct.Svg.html
fn draw(&mut self, handle: Handle, layout: Layout<'_>) -> Self::Output; fn draw(&mut self, handle: Handle, layout: Layout<'_>) -> Self::Output;
} }

View File

@ -33,8 +33,6 @@ pub struct Text<Renderer: self::Renderer> {
impl<Renderer: self::Renderer> Text<Renderer> { impl<Renderer: self::Renderer> Text<Renderer> {
/// Create a new fragment of [`Text`] with the given contents. /// Create a new fragment of [`Text`] with the given contents.
///
/// [`Text`]: struct.Text.html
pub fn new<T: Into<String>>(label: T) -> Self { pub fn new<T: Into<String>>(label: T) -> Self {
Text { Text {
content: label.into(), content: label.into(),
@ -49,17 +47,12 @@ impl<Renderer: self::Renderer> Text<Renderer> {
} }
/// Sets the size of the [`Text`]. /// Sets the size of the [`Text`].
///
/// [`Text`]: struct.Text.html
pub fn size(mut self, size: u16) -> Self { pub fn size(mut self, size: u16) -> Self {
self.size = Some(size); self.size = Some(size);
self self
} }
/// Sets the [`Color`] of the [`Text`]. /// Sets the [`Color`] of the [`Text`].
///
/// [`Text`]: struct.Text.html
/// [`Color`]: ../../struct.Color.html
pub fn color<C: Into<Color>>(mut self, color: C) -> Self { pub fn color<C: Into<Color>>(mut self, color: C) -> Self {
self.color = Some(color.into()); self.color = Some(color.into());
self self
@ -67,33 +60,25 @@ impl<Renderer: self::Renderer> Text<Renderer> {
/// Sets the [`Font`] of the [`Text`]. /// Sets the [`Font`] of the [`Text`].
/// ///
/// [`Text`]: struct.Text.html /// [`Font`]: Renderer::Font
/// [`Font`]: ../../struct.Font.html
pub fn font(mut self, font: impl Into<Renderer::Font>) -> Self { pub fn font(mut self, font: impl Into<Renderer::Font>) -> Self {
self.font = font.into(); self.font = font.into();
self self
} }
/// Sets the width of the [`Text`] boundaries. /// Sets the width of the [`Text`] boundaries.
///
/// [`Text`]: struct.Text.html
pub fn width(mut self, width: Length) -> Self { pub fn width(mut self, width: Length) -> Self {
self.width = width; self.width = width;
self self
} }
/// Sets the height of the [`Text`] boundaries. /// Sets the height of the [`Text`] boundaries.
///
/// [`Text`]: struct.Text.html
pub fn height(mut self, height: Length) -> Self { pub fn height(mut self, height: Length) -> Self {
self.height = height; self.height = height;
self self
} }
/// Sets the [`HorizontalAlignment`] of the [`Text`]. /// Sets the [`HorizontalAlignment`] of the [`Text`].
///
/// [`Text`]: struct.Text.html
/// [`HorizontalAlignment`]: enum.HorizontalAlignment.html
pub fn horizontal_alignment( pub fn horizontal_alignment(
mut self, mut self,
alignment: HorizontalAlignment, alignment: HorizontalAlignment,
@ -103,9 +88,6 @@ impl<Renderer: self::Renderer> Text<Renderer> {
} }
/// Sets the [`VerticalAlignment`] of the [`Text`]. /// Sets the [`VerticalAlignment`] of the [`Text`].
///
/// [`Text`]: struct.Text.html
/// [`VerticalAlignment`]: enum.VerticalAlignment.html
pub fn vertical_alignment(mut self, alignment: VerticalAlignment) -> Self { pub fn vertical_alignment(mut self, alignment: VerticalAlignment) -> Self {
self.vertical_alignment = alignment; self.vertical_alignment = alignment;
self self
@ -177,26 +159,18 @@ where
/// The renderer of a [`Text`] fragment. /// The renderer of a [`Text`] fragment.
/// ///
/// Your [renderer] will need to implement this trait before being /// Your [renderer] will need to implement this trait before being
/// able to use [`Text`] in your [`UserInterface`]. /// able to use [`Text`] in your user interface.
/// ///
/// [`Text`]: struct.Text.html /// [renderer]: crate::Renderer
/// [renderer]: ../../renderer/index.html
/// [`UserInterface`]: ../../struct.UserInterface.html
pub trait Renderer: crate::Renderer { pub trait Renderer: crate::Renderer {
/// The font type used for [`Text`]. /// The font type used for [`Text`].
///
/// [`Text`]: struct.Text.html
type Font: Default + Copy; type Font: Default + Copy;
/// Returns the default size of [`Text`]. /// Returns the default size of [`Text`].
///
/// [`Text`]: struct.Text.html
fn default_size(&self) -> u16; fn default_size(&self) -> u16;
/// Measures the [`Text`] in the given bounds and returns the minimum /// Measures the [`Text`] in the given bounds and returns the minimum
/// boundaries that can fit the contents. /// boundaries that can fit the contents.
///
/// [`Text`]: struct.Text.html
fn measure( fn measure(
&self, &self,
content: &str, content: &str,
@ -214,10 +188,6 @@ pub trait Renderer: crate::Renderer {
/// * the color of the [`Text`] /// * the color of the [`Text`]
/// * the [`HorizontalAlignment`] of the [`Text`] /// * the [`HorizontalAlignment`] of the [`Text`]
/// * the [`VerticalAlignment`] of the [`Text`] /// * the [`VerticalAlignment`] of the [`Text`]
///
/// [`Text`]: struct.Text.html
/// [`HorizontalAlignment`]: enum.HorizontalAlignment.html
/// [`VerticalAlignment`]: enum.VerticalAlignment.html
fn draw( fn draw(
&mut self, &mut self,
defaults: &Self::Defaults, defaults: &Self::Defaults,

View File

@ -1,9 +1,6 @@
//! Display fields that can be filled with text. //! Display fields that can be filled with text.
//! //!
//! A [`TextInput`] has some local [`State`]. //! A [`TextInput`] has some local [`State`].
//!
//! [`TextInput`]: struct.TextInput.html
//! [`State`]: struct.State.html
mod editor; mod editor;
mod value; mod value;
@ -77,9 +74,6 @@ where
/// - a placeholder /// - a placeholder
/// - the current value /// - the current value
/// - a function that produces a message when the [`TextInput`] changes /// - a function that produces a message when the [`TextInput`] changes
///
/// [`TextInput`]: struct.TextInput.html
/// [`State`]: struct.State.html
pub fn new<F>( pub fn new<F>(
state: &'a mut State, state: &'a mut State,
placeholder: &str, placeholder: &str,
@ -106,8 +100,6 @@ where
} }
/// Converts the [`TextInput`] into a secure password input. /// Converts the [`TextInput`] into a secure password input.
///
/// [`TextInput`]: struct.TextInput.html
pub fn password(mut self) -> Self { pub fn password(mut self) -> Self {
self.is_secure = true; self.is_secure = true;
self self
@ -115,39 +107,31 @@ where
/// Sets the [`Font`] of the [`Text`]. /// Sets the [`Font`] of the [`Text`].
/// ///
/// [`Text`]: struct.Text.html /// [`Font`]: crate::widget::text::Renderer::Font
/// [`Font`]: ../../struct.Font.html /// [`Text`]: crate::widget::Text
pub fn font(mut self, font: Renderer::Font) -> Self { pub fn font(mut self, font: Renderer::Font) -> Self {
self.font = font; self.font = font;
self self
} }
/// Sets the width of the [`TextInput`]. /// Sets the width of the [`TextInput`].
///
/// [`TextInput`]: struct.TextInput.html
pub fn width(mut self, width: Length) -> Self { pub fn width(mut self, width: Length) -> Self {
self.width = width; self.width = width;
self self
} }
/// Sets the maximum width of the [`TextInput`]. /// Sets the maximum width of the [`TextInput`].
///
/// [`TextInput`]: struct.TextInput.html
pub fn max_width(mut self, max_width: u32) -> Self { pub fn max_width(mut self, max_width: u32) -> Self {
self.max_width = max_width; self.max_width = max_width;
self self
} }
/// Sets the padding of the [`TextInput`]. /// Sets the padding of the [`TextInput`].
///
/// [`TextInput`]: struct.TextInput.html
pub fn padding(mut self, units: u16) -> Self { pub fn padding(mut self, units: u16) -> Self {
self.padding = units; self.padding = units;
self self
} }
/// Sets the text size of the [`TextInput`]. /// Sets the text size of the [`TextInput`].
///
/// [`TextInput`]: struct.TextInput.html
pub fn size(mut self, size: u16) -> Self { pub fn size(mut self, size: u16) -> Self {
self.size = Some(size); self.size = Some(size);
self self
@ -155,26 +139,18 @@ where
/// Sets the message that should be produced when the [`TextInput`] is /// Sets the message that should be produced when the [`TextInput`] is
/// focused and the enter key is pressed. /// focused and the enter key is pressed.
///
/// [`TextInput`]: struct.TextInput.html
pub fn on_submit(mut self, message: Message) -> Self { pub fn on_submit(mut self, message: Message) -> Self {
self.on_submit = Some(message); self.on_submit = Some(message);
self self
} }
/// Sets the style of the [`TextInput`]. /// Sets the style of the [`TextInput`].
///
/// [`TextInput`]: struct.TextInput.html
/// [`State`]: struct.State.html
pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self {
self.style = style.into(); self.style = style.into();
self self
} }
/// Returns the current [`State`] of the [`TextInput`]. /// Returns the current [`State`] of the [`TextInput`].
///
/// [`TextInput`]: struct.TextInput.html
/// [`State`]: struct.State.html
pub fn state(&self) -> &State { pub fn state(&self) -> &State {
self.state self.state
} }
@ -186,10 +162,6 @@ where
{ {
/// Draws the [`TextInput`] with the given [`Renderer`], overriding its /// Draws the [`TextInput`] with the given [`Renderer`], overriding its
/// [`Value`] if provided. /// [`Value`] if provided.
///
/// [`TextInput`]: struct.TextInput.html
/// [`Renderer`]: trait.Render.html
/// [`Value`]: struct.Value.html
pub fn draw( pub fn draw(
&self, &self,
renderer: &mut Renderer, renderer: &mut Renderer,
@ -628,15 +600,12 @@ where
/// Your [renderer] will need to implement this trait before being /// Your [renderer] will need to implement this trait before being
/// able to use a [`TextInput`] in your user interface. /// able to use a [`TextInput`] in your user interface.
/// ///
/// [`TextInput`]: struct.TextInput.html /// [renderer]: crate::renderer
/// [renderer]: ../../renderer/index.html
pub trait Renderer: text::Renderer + Sized { pub trait Renderer: text::Renderer + Sized {
/// The style supported by this renderer. /// The style supported by this renderer.
type Style: Default; type Style: Default;
/// Returns the width of the value of the [`TextInput`]. /// Returns the width of the value of the [`TextInput`].
///
/// [`TextInput`]: struct.TextInput.html
fn measure_value(&self, value: &str, size: u16, font: Self::Font) -> f32; fn measure_value(&self, value: &str, size: u16, font: Self::Font) -> f32;
/// Returns the current horizontal offset of the value of the /// Returns the current horizontal offset of the value of the
@ -644,9 +613,6 @@ pub trait Renderer: text::Renderer + Sized {
/// ///
/// This is the amount of horizontal scrolling applied when the [`Value`] /// This is the amount of horizontal scrolling applied when the [`Value`]
/// does not fit the [`TextInput`]. /// does not fit the [`TextInput`].
///
/// [`TextInput`]: struct.TextInput.html
/// [`Value`]: struct.Value.html
fn offset( fn offset(
&self, &self,
text_bounds: Rectangle, text_bounds: Rectangle,
@ -665,10 +631,6 @@ pub trait Renderer: text::Renderer + Sized {
/// - the placeholder to show when the value is empty /// - the placeholder to show when the value is empty
/// - the current [`Value`] /// - the current [`Value`]
/// - the current [`State`] /// - the current [`State`]
///
/// [`TextInput`]: struct.TextInput.html
/// [`Value`]: struct.Value.html
/// [`State`]: struct.State.html
fn draw( fn draw(
&mut self, &mut self,
bounds: Rectangle, bounds: Rectangle,
@ -684,8 +646,6 @@ pub trait Renderer: text::Renderer + Sized {
/// Computes the position of the text cursor at the given X coordinate of /// Computes the position of the text cursor at the given X coordinate of
/// a [`TextInput`]. /// a [`TextInput`].
///
/// [`TextInput`]: struct.TextInput.html
fn find_cursor_position( fn find_cursor_position(
&self, &self,
text_bounds: Rectangle, text_bounds: Rectangle,
@ -725,8 +685,6 @@ where
} }
/// The state of a [`TextInput`]. /// The state of a [`TextInput`].
///
/// [`TextInput`]: struct.TextInput.html
#[derive(Debug, Default, Clone)] #[derive(Debug, Default, Clone)]
pub struct State { pub struct State {
is_focused: bool, is_focused: bool,
@ -740,15 +698,11 @@ pub struct State {
impl State { impl State {
/// Creates a new [`State`], representing an unfocused [`TextInput`]. /// Creates a new [`State`], representing an unfocused [`TextInput`].
///
/// [`State`]: struct.State.html
pub fn new() -> Self { pub fn new() -> Self {
Self::default() Self::default()
} }
/// Creates a new [`State`], representing a focused [`TextInput`]. /// Creates a new [`State`], representing a focused [`TextInput`].
///
/// [`State`]: struct.State.html
pub fn focused() -> Self { pub fn focused() -> Self {
Self { Self {
is_focused: true, is_focused: true,
@ -761,54 +715,36 @@ impl State {
} }
/// Returns whether the [`TextInput`] is currently focused or not. /// Returns whether the [`TextInput`] is currently focused or not.
///
/// [`TextInput`]: struct.TextInput.html
pub fn is_focused(&self) -> bool { pub fn is_focused(&self) -> bool {
self.is_focused self.is_focused
} }
/// Returns the [`Cursor`] of the [`TextInput`]. /// Returns the [`Cursor`] of the [`TextInput`].
///
/// [`Cursor`]: struct.Cursor.html
/// [`TextInput`]: struct.TextInput.html
pub fn cursor(&self) -> Cursor { pub fn cursor(&self) -> Cursor {
self.cursor self.cursor
} }
/// Focuses the [`TextInput`]. /// Focuses the [`TextInput`].
///
/// [`TextInput`]: struct.TextInput.html
pub fn focus(&mut self) { pub fn focus(&mut self) {
self.is_focused = true; self.is_focused = true;
} }
/// Unfocuses the [`TextInput`]. /// Unfocuses the [`TextInput`].
///
/// [`TextInput`]: struct.TextInput.html
pub fn unfocus(&mut self) { pub fn unfocus(&mut self) {
self.is_focused = false; self.is_focused = false;
} }
/// Moves the [`Cursor`] of the [`TextInput`] to the front of the input text. /// Moves the [`Cursor`] of the [`TextInput`] to the front of the input text.
///
/// [`Cursor`]: struct.Cursor.html
/// [`TextInput`]: struct.TextInput.html
pub fn move_cursor_to_front(&mut self) { pub fn move_cursor_to_front(&mut self) {
self.cursor.move_to(0); self.cursor.move_to(0);
} }
/// Moves the [`Cursor`] of the [`TextInput`] to the end of the input text. /// Moves the [`Cursor`] of the [`TextInput`] to the end of the input text.
///
/// [`Cursor`]: struct.Cursor.html
/// [`TextInput`]: struct.TextInput.html
pub fn move_cursor_to_end(&mut self) { pub fn move_cursor_to_end(&mut self) {
self.cursor.move_to(usize::MAX); self.cursor.move_to(usize::MAX);
} }
/// Moves the [`Cursor`] of the [`TextInput`] to an arbitrary location. /// Moves the [`Cursor`] of the [`TextInput`] to an arbitrary location.
///
/// [`Cursor`]: struct.Cursor.html
/// [`TextInput`]: struct.TextInput.html
pub fn move_cursor_to(&mut self, position: usize) { pub fn move_cursor_to(&mut self, position: usize) {
self.cursor.move_to(position); self.cursor.move_to(position);
} }

View File

@ -8,8 +8,6 @@ pub struct Cursor {
} }
/// The state of a [`Cursor`]. /// The state of a [`Cursor`].
///
/// [`Cursor`]: struct.Cursor.html
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub enum State { pub enum State {
/// Cursor without a selection /// Cursor without a selection
@ -34,9 +32,6 @@ impl Default for Cursor {
impl Cursor { impl Cursor {
/// Returns the [`State`] of the [`Cursor`]. /// Returns the [`State`] of the [`Cursor`].
///
/// [`State`]: struct.State.html
/// [`Cursor`]: struct.Cursor.html
pub fn state(&self, value: &Value) -> State { pub fn state(&self, value: &Value) -> State {
match self.state { match self.state {
State::Index(index) => State::Index(index.min(value.len())), State::Index(index) => State::Index(index.min(value.len())),

View File

@ -2,7 +2,7 @@ use unicode_segmentation::UnicodeSegmentation;
/// The value of a [`TextInput`]. /// The value of a [`TextInput`].
/// ///
/// [`TextInput`]: struct.TextInput.html /// [`TextInput`]: crate::widget::TextInput
// TODO: Reduce allocations, cache results (?) // TODO: Reduce allocations, cache results (?)
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Value { pub struct Value {
@ -11,8 +11,6 @@ pub struct Value {
impl Value { impl Value {
/// Creates a new [`Value`] from a string slice. /// Creates a new [`Value`] from a string slice.
///
/// [`Value`]: struct.Value.html
pub fn new(string: &str) -> Self { pub fn new(string: &str) -> Self {
let graphemes = UnicodeSegmentation::graphemes(string, true) let graphemes = UnicodeSegmentation::graphemes(string, true)
.map(String::from) .map(String::from)
@ -24,23 +22,17 @@ impl Value {
/// Returns whether the [`Value`] is empty or not. /// Returns whether the [`Value`] is empty or not.
/// ///
/// A [`Value`] is empty when it contains no graphemes. /// A [`Value`] is empty when it contains no graphemes.
///
/// [`Value`]: struct.Value.html
pub fn is_empty(&self) -> bool { pub fn is_empty(&self) -> bool {
self.len() == 0 self.len() == 0
} }
/// Returns the total amount of graphemes in the [`Value`]. /// Returns the total amount of graphemes in the [`Value`].
///
/// [`Value`]: struct.Value.html
pub fn len(&self) -> usize { pub fn len(&self) -> usize {
self.graphemes.len() self.graphemes.len()
} }
/// Returns the position of the previous start of a word from the given /// Returns the position of the previous start of a word from the given
/// grapheme `index`. /// grapheme `index`.
///
/// [`Value`]: struct.Value.html
pub fn previous_start_of_word(&self, index: usize) -> usize { pub fn previous_start_of_word(&self, index: usize) -> usize {
let previous_string = let previous_string =
&self.graphemes[..index.min(self.graphemes.len())].concat(); &self.graphemes[..index.min(self.graphemes.len())].concat();
@ -63,8 +55,6 @@ impl Value {
/// Returns the position of the next end of a word from the given grapheme /// Returns the position of the next end of a word from the given grapheme
/// `index`. /// `index`.
///
/// [`Value`]: struct.Value.html
pub fn next_end_of_word(&self, index: usize) -> usize { pub fn next_end_of_word(&self, index: usize) -> usize {
let next_string = &self.graphemes[index..].concat(); let next_string = &self.graphemes[index..].concat();
@ -85,8 +75,6 @@ impl Value {
/// Returns a new [`Value`] containing the graphemes until the given /// Returns a new [`Value`] containing the graphemes until the given
/// `index`. /// `index`.
///
/// [`Value`]: struct.Value.html
pub fn until(&self, index: usize) -> Self { pub fn until(&self, index: usize) -> Self {
let graphemes = self.graphemes[..index.min(self.len())].to_vec(); let graphemes = self.graphemes[..index.min(self.len())].to_vec();
@ -94,8 +82,6 @@ impl Value {
} }
/// Converts the [`Value`] into a `String`. /// Converts the [`Value`] into a `String`.
///
/// [`Value`]: struct.Value.html
pub fn to_string(&self) -> String { pub fn to_string(&self) -> String {
self.graphemes.concat() self.graphemes.concat()
} }
@ -118,8 +104,6 @@ impl Value {
} }
/// Removes the grapheme at the given `index`. /// Removes the grapheme at the given `index`.
///
/// [`Value`]: struct.Value.html
pub fn remove(&mut self, index: usize) { pub fn remove(&mut self, index: usize) {
let _ = self.graphemes.remove(index); let _ = self.graphemes.remove(index);
} }
@ -131,8 +115,6 @@ impl Value {
/// Returns a new [`Value`] with all its graphemes replaced with the /// Returns a new [`Value`] with all its graphemes replaced with the
/// dot ('•') character. /// dot ('•') character.
///
/// [`Value`]: struct.Value.html
pub fn secure(&self) -> Self { pub fn secure(&self) -> Self {
Self { Self {
graphemes: std::iter::repeat(String::from("")) graphemes: std::iter::repeat(String::from(""))

View File

@ -11,15 +11,13 @@ use crate::{Color, Command, Element, Executor, Settings, Subscription};
/// document. /// document.
/// ///
/// An [`Application`] can execute asynchronous actions by returning a /// An [`Application`] can execute asynchronous actions by returning a
/// [`Command`](struct.Command.html) in some of its methods. If /// [`Command`] in some of its methods. If you do not intend to perform any
/// you do not intend to perform any background work in your program, the /// background work in your program, the [`Sandbox`] trait offers a simplified
/// [`Sandbox`](trait.Sandbox.html) trait offers a simplified interface. /// interface.
/// ///
/// When using an [`Application`] with the `debug` feature enabled, a debug view /// When using an [`Application`] with the `debug` feature enabled, a debug view
/// can be toggled by pressing `F12`. /// can be toggled by pressing `F12`.
/// ///
/// [`Application`]: trait.Application.html
///
/// # Examples /// # Examples
/// [The repository has a bunch of examples] that use the [`Application`] trait: /// [The repository has a bunch of examples] that use the [`Application`] trait:
/// ///
@ -45,9 +43,9 @@ use crate::{Color, Command, Element, Executor, Settings, Subscription};
/// [`solar_system`]: https://github.com/hecrj/iced/tree/0.1/examples/solar_system /// [`solar_system`]: https://github.com/hecrj/iced/tree/0.1/examples/solar_system
/// [`stopwatch`]: https://github.com/hecrj/iced/tree/0.1/examples/stopwatch /// [`stopwatch`]: https://github.com/hecrj/iced/tree/0.1/examples/stopwatch
/// [`todos`]: https://github.com/hecrj/iced/tree/0.1/examples/todos /// [`todos`]: https://github.com/hecrj/iced/tree/0.1/examples/todos
/// [`Canvas`]: widget/canvas/struct.Canvas.html /// [`Sandbox`]: crate::Sandbox
/// [`Canvas`]: crate::widget::Canvas
/// [PokéAPI]: https://pokeapi.co/ /// [PokéAPI]: https://pokeapi.co/
/// [`Subscription`]: type.Subscription.html
/// [TodoMVC]: http://todomvc.com/ /// [TodoMVC]: http://todomvc.com/
/// ///
/// ## A simple "Hello, world!" /// ## A simple "Hello, world!"
@ -91,18 +89,14 @@ pub trait Application: Sized {
/// ///
/// The [default executor] can be a good starting point! /// The [default executor] can be a good starting point!
/// ///
/// [`Executor`]: trait.Executor.html /// [`Executor`]: Self::Executor
/// [default executor]: executor/struct.Default.html /// [default executor]: crate::executor::Default
type Executor: Executor; type Executor: Executor;
/// The type of __messages__ your [`Application`] will produce. /// The type of __messages__ your [`Application`] will produce.
///
/// [`Application`]: trait.Application.html
type Message: std::fmt::Debug + Send; type Message: std::fmt::Debug + Send;
/// The data needed to initialize your [`Application`]. /// The data needed to initialize your [`Application`].
///
/// [`Application`]: trait.Application.html
type Flags; type Flags;
/// Initializes the [`Application`] with the flags provided to /// Initializes the [`Application`] with the flags provided to
@ -110,22 +104,17 @@ pub trait Application: Sized {
/// ///
/// Here is where you should return the initial state of your app. /// Here is where you should return the initial state of your app.
/// ///
/// Additionally, you can return a [`Command`](struct.Command.html) if you /// Additionally, you can return a [`Command`] if you need to perform some
/// need to perform some async action in the background on startup. This is /// async action in the background on startup. This is useful if you want to
/// useful if you want to load state from a file, perform an initial HTTP /// load state from a file, perform an initial HTTP request, etc.
/// request, etc.
/// ///
/// [`Application`]: trait.Application.html /// [`run`]: Self::run
/// [`run`]: #method.run.html
/// [`Settings`]: struct.Settings.html
fn new(flags: Self::Flags) -> (Self, Command<Self::Message>); fn new(flags: Self::Flags) -> (Self, Command<Self::Message>);
/// Returns the current title of the [`Application`]. /// Returns the current title of the [`Application`].
/// ///
/// This title can be dynamic! The runtime will automatically update the /// This title can be dynamic! The runtime will automatically update the
/// title of your application when necessary. /// title of your application when necessary.
///
/// [`Application`]: trait.Application.html
fn title(&self) -> String; fn title(&self) -> String;
/// Handles a __message__ and updates the state of the [`Application`]. /// Handles a __message__ and updates the state of the [`Application`].
@ -135,9 +124,6 @@ pub trait Application: Sized {
/// this method. /// this method.
/// ///
/// Any [`Command`] returned will be executed immediately in the background. /// Any [`Command`] returned will be executed immediately in the background.
///
/// [`Application`]: trait.Application.html
/// [`Command`]: struct.Command.html
fn update(&mut self, message: Self::Message) -> Command<Self::Message>; fn update(&mut self, message: Self::Message) -> Command<Self::Message>;
/// Returns the event [`Subscription`] for the current state of the /// Returns the event [`Subscription`] for the current state of the
@ -148,8 +134,6 @@ pub trait Application: Sized {
/// [`update`](#tymethod.update). /// [`update`](#tymethod.update).
/// ///
/// By default, this method returns an empty [`Subscription`]. /// By default, this method returns an empty [`Subscription`].
///
/// [`Subscription`]: struct.Subscription.html
fn subscription(&self) -> Subscription<Self::Message> { fn subscription(&self) -> Subscription<Self::Message> {
Subscription::none() Subscription::none()
} }
@ -157,8 +141,6 @@ pub trait Application: Sized {
/// Returns the widgets to display in the [`Application`]. /// Returns the widgets to display in the [`Application`].
/// ///
/// These widgets can produce __messages__ based on user interaction. /// These widgets can produce __messages__ based on user interaction.
///
/// [`Application`]: trait.Application.html
fn view(&mut self) -> Element<'_, Self::Message>; fn view(&mut self) -> Element<'_, Self::Message>;
/// Returns the current [`Application`] mode. /// Returns the current [`Application`] mode.
@ -169,8 +151,6 @@ pub trait Application: Sized {
/// Currently, the mode only has an effect in native platforms. /// Currently, the mode only has an effect in native platforms.
/// ///
/// By default, an application will run in windowed mode. /// By default, an application will run in windowed mode.
///
/// [`Application`]: trait.Application.html
fn mode(&self) -> window::Mode { fn mode(&self) -> window::Mode {
window::Mode::Windowed window::Mode::Windowed
} }
@ -178,9 +158,6 @@ pub trait Application: Sized {
/// Returns the background color of the [`Application`]. /// Returns the background color of the [`Application`].
/// ///
/// By default, it returns [`Color::WHITE`]. /// By default, it returns [`Color::WHITE`].
///
/// [`Application`]: trait.Application.html
/// [`Color::WHITE`]: struct.Color.html#const.WHITE
fn background_color(&self) -> Color { fn background_color(&self) -> Color {
Color::WHITE Color::WHITE
} }
@ -194,8 +171,6 @@ pub trait Application: Sized {
/// while a scale factor of `0.5` will shrink them to half their size. /// while a scale factor of `0.5` will shrink them to half their size.
/// ///
/// By default, it returns `1.0`. /// By default, it returns `1.0`.
///
/// [`Application`]: trait.Application.html
fn scale_factor(&self) -> f64 { fn scale_factor(&self) -> f64 {
1.0 1.0
} }
@ -207,8 +182,7 @@ pub trait Application: Sized {
/// ///
/// It should probably be that last thing you call in your `main` function. /// It should probably be that last thing you call in your `main` function.
/// ///
/// [`Application`]: trait.Application.html /// [`Error`]: crate::Error
/// [`Error`]: enum.Error.html
fn run(settings: Settings<Self::Flags>) -> crate::Result fn run(settings: Settings<Self::Flags>) -> crate::Result
where where
Self: 'static, Self: 'static,

View File

@ -171,8 +171,6 @@
//! //!
//! [Elm]: https://elm-lang.org/ //! [Elm]: https://elm-lang.org/
//! [The Elm Architecture]: https://guide.elm-lang.org/architecture/ //! [The Elm Architecture]: https://guide.elm-lang.org/architecture/
//! [`Application`]: trait.Application.html
//! [`Sandbox`]: trait.Sandbox.html
#![deny(missing_docs)] #![deny(missing_docs)]
#![deny(missing_debug_implementations)] #![deny(missing_debug_implementations)]
#![deny(unused_results)] #![deny(unused_results)]

View File

@ -2,5 +2,5 @@ use crate::Error;
/// The result of running an [`Application`]. /// The result of running an [`Application`].
/// ///
/// [`Application`]: trait.Application.html /// [`Application`]: crate::Application
pub type Result = std::result::Result<(), Error>; pub type Result = std::result::Result<(), Error>;

View File

@ -14,11 +14,6 @@ use crate::{
/// Therefore, it is recommended to always start by implementing this trait and /// Therefore, it is recommended to always start by implementing this trait and
/// upgrade only once necessary. /// upgrade only once necessary.
/// ///
/// [`Application`]: trait.Application.html
/// [`Sandbox`]: trait.Sandbox.html
/// [`Command`]: struct.Command.html
/// [`Command::none`]: struct.Command.html#method.none
///
/// # Examples /// # Examples
/// [The repository has a bunch of examples] that use the [`Sandbox`] trait: /// [The repository has a bunch of examples] that use the [`Sandbox`] trait:
/// ///
@ -53,7 +48,7 @@ use crate::{
/// [`lyon`]: https://github.com/nical/lyon /// [`lyon`]: https://github.com/nical/lyon
/// [the overview]: index.html#overview /// [the overview]: index.html#overview
/// [`iced_wgpu`]: https://github.com/hecrj/iced/tree/0.1/wgpu /// [`iced_wgpu`]: https://github.com/hecrj/iced/tree/0.1/wgpu
/// [`Svg` widget]: widget/svg/struct.Svg.html /// [`Svg` widget]: crate::widget::Svg
/// [Ghostscript Tiger]: https://commons.wikimedia.org/wiki/File:Ghostscript_Tiger.svg /// [Ghostscript Tiger]: https://commons.wikimedia.org/wiki/File:Ghostscript_Tiger.svg
/// ///
/// ## A simple "Hello, world!" /// ## A simple "Hello, world!"
@ -92,46 +87,33 @@ use crate::{
/// ``` /// ```
pub trait Sandbox { pub trait Sandbox {
/// The type of __messages__ your [`Sandbox`] will produce. /// The type of __messages__ your [`Sandbox`] will produce.
///
/// [`Sandbox`]: trait.Sandbox.html
type Message: std::fmt::Debug + Send; type Message: std::fmt::Debug + Send;
/// Initializes the [`Sandbox`]. /// Initializes the [`Sandbox`].
/// ///
/// Here is where you should return the initial state of your app. /// Here is where you should return the initial state of your app.
///
/// [`Sandbox`]: trait.Sandbox.html
fn new() -> Self; fn new() -> Self;
/// Returns the current title of the [`Sandbox`]. /// Returns the current title of the [`Sandbox`].
/// ///
/// This title can be dynamic! The runtime will automatically update the /// This title can be dynamic! The runtime will automatically update the
/// title of your application when necessary. /// title of your application when necessary.
///
/// [`Sandbox`]: trait.Sandbox.html
fn title(&self) -> String; fn title(&self) -> String;
/// Handles a __message__ and updates the state of the [`Sandbox`]. /// Handles a __message__ and updates the state of the [`Sandbox`].
/// ///
/// This is where you define your __update logic__. All the __messages__, /// This is where you define your __update logic__. All the __messages__,
/// produced by user interactions, will be handled by this method. /// produced by user interactions, will be handled by this method.
///
/// [`Sandbox`]: trait.Sandbox.html
fn update(&mut self, message: Self::Message); fn update(&mut self, message: Self::Message);
/// Returns the widgets to display in the [`Sandbox`]. /// Returns the widgets to display in the [`Sandbox`].
/// ///
/// These widgets can produce __messages__ based on user interaction. /// These widgets can produce __messages__ based on user interaction.
///
/// [`Sandbox`]: trait.Sandbox.html
fn view(&mut self) -> Element<'_, Self::Message>; fn view(&mut self) -> Element<'_, Self::Message>;
/// Returns the background color of the [`Sandbox`]. /// Returns the background color of the [`Sandbox`].
/// ///
/// By default, it returns [`Color::WHITE`]. /// By default, it returns [`Color::WHITE`].
///
/// [`Sandbox`]: trait.Sandbox.html
/// [`Color::WHITE`]: struct.Color.html#const.WHITE
fn background_color(&self) -> Color { fn background_color(&self) -> Color {
Color::WHITE Color::WHITE
} }
@ -145,8 +127,6 @@ pub trait Sandbox {
/// while a scale factor of `0.5` will shrink them to half their size. /// while a scale factor of `0.5` will shrink them to half their size.
/// ///
/// By default, it returns `1.0`. /// By default, it returns `1.0`.
///
/// [`Sandbox`]: trait.Sandbox.html
fn scale_factor(&self) -> f64 { fn scale_factor(&self) -> f64 {
1.0 1.0
} }
@ -157,8 +137,6 @@ pub trait Sandbox {
/// and __will NOT return__. /// and __will NOT return__.
/// ///
/// It should probably be that last thing you call in your `main` function. /// It should probably be that last thing you call in your `main` function.
///
/// [`Sandbox`]: trait.Sandbox.html
fn run(settings: Settings<()>) -> Result<(), Error> fn run(settings: Settings<()>) -> Result<(), Error>
where where
Self: 'static + Sized, Self: 'static + Sized,

View File

@ -7,13 +7,11 @@ pub struct Settings<Flags> {
/// The window settings. /// The window settings.
/// ///
/// They will be ignored on the Web. /// They will be ignored on the Web.
///
/// [`Window`]: struct.Window.html
pub window: window::Settings, pub window: window::Settings,
/// The data needed to initialize an [`Application`]. /// The data needed to initialize an [`Application`].
/// ///
/// [`Application`]: ../trait.Application.html /// [`Application`]: crate::Application
pub flags: Flags, pub flags: Flags,
/// The bytes of the font that will be used by default. /// The bytes of the font that will be used by default.
@ -35,14 +33,14 @@ pub struct Settings<Flags> {
/// ///
/// By default, it is disabled. /// By default, it is disabled.
/// ///
/// [`Canvas`]: ../widget/canvas/struct.Canvas.html /// [`Canvas`]: crate::widget::Canvas
pub antialiasing: bool, pub antialiasing: bool,
} }
impl<Flags> Settings<Flags> { impl<Flags> Settings<Flags> {
/// Initialize application settings using the given data. /// Initialize [`Application`] settings using the given data.
/// ///
/// [`Application`]: ../trait.Application.html /// [`Application`]: crate::Application
pub fn with_flags(flags: Flags) -> Self { pub fn with_flags(flags: Flags) -> Self {
let default_settings = Settings::<()>::default(); let default_settings = Settings::<()>::default();

View File

@ -5,8 +5,6 @@ use crate::Subscription;
/// ///
/// The first message is produced after a `duration`, and then continues to /// The first message is produced after a `duration`, and then continues to
/// produce more messages every `duration` after that. /// produce more messages every `duration` after that.
///
/// [`Subscription`]: ../subscription/struct.Subscription.html
pub fn every( pub fn every(
duration: std::time::Duration, duration: std::time::Duration,
) -> Subscription<std::time::Instant> { ) -> Subscription<std::time::Instant> {

View File

@ -13,9 +13,6 @@
//! //!
//! These widgets have their own module with a `State` type. For instance, a //! These widgets have their own module with a `State` type. For instance, a
//! [`TextInput`] has some [`text_input::State`]. //! [`TextInput`] has some [`text_input::State`].
//!
//! [`TextInput`]: text_input/struct.TextInput.html
//! [`text_input::State`]: text_input/struct.State.html
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
mod platform { mod platform {
pub use crate::renderer::widget::{ pub use crate::renderer::widget::{

View File

@ -76,8 +76,6 @@ pub struct Style {
/// The radius of the line corners. /// The radius of the line corners.
pub radius: f32, pub radius: f32,
/// The [`FillMode`] of the rule. /// The [`FillMode`] of the rule.
///
/// [`FillMode`]: enum.FillMode.html
pub fill_mode: FillMode, pub fill_mode: FillMode,
} }

Some files were not shown because too many files have changed in this diff Show More