diff options
author | 2020-11-26 02:52:34 +0100 | |
---|---|---|
committer | 2020-11-26 02:52:34 +0100 | |
commit | 1f7e8b7f3d1804c39c8e0934b25f3ef178de269c (patch) | |
tree | 380d9224b81537e460ea7f9fe84c0c912d3f4cbf /graphics/src | |
parent | bffaeed9fd44619491c012cd9270043828c1849c (diff) | |
parent | 01322f69a406eee76014f5e2834336e2295ad80e (diff) | |
download | iced-1f7e8b7f3d1804c39c8e0934b25f3ef178de269c.tar.gz iced-1f7e8b7f3d1804c39c8e0934b25f3ef178de269c.tar.bz2 iced-1f7e8b7f3d1804c39c8e0934b25f3ef178de269c.zip |
Merge pull request #632 from hecrj/improvement/update-docs
Use intra-doc links
Diffstat (limited to 'graphics/src')
26 files changed, 31 insertions, 254 deletions
diff --git a/graphics/src/antialiasing.rs b/graphics/src/antialiasing.rs index 34d94711..7631c97c 100644 --- a/graphics/src/antialiasing.rs +++ b/graphics/src/antialiasing.rs @@ -13,8 +13,6 @@ pub enum Antialiasing { impl Antialiasing { /// Returns the amount of samples of the [`Antialiasing`]. - /// - /// [`Antialiasing`]: enum.Antialiasing.html pub fn sample_count(self) -> u32 { match self { Antialiasing::MSAAx2 => 2, diff --git a/graphics/src/backend.rs b/graphics/src/backend.rs index dd7dbbc2..ed1b9e08 100644 --- a/graphics/src/backend.rs +++ b/graphics/src/backend.rs @@ -5,7 +5,7 @@ use iced_native::{Font, Size}; /// The graphics backend of a [`Renderer`]. /// -/// [`Renderer`]: ../struct.Renderer.html +/// [`Renderer`]: crate::Renderer pub trait Backend { /// Trims the measurements cache. /// @@ -22,12 +22,12 @@ pub trait Text { /// The `char` representing a ✔ icon in the [`ICON_FONT`]. /// - /// [`ICON_FONT`]: #associatedconst.ICON_FONT + /// [`ICON_FONT`]: Self::ICON_FONT const CHECKMARK_ICON: char; - /// The `char` representing a ▼ icon in the built-in [`ICONS`] font. + /// The `char` representing a ▼ icon in the built-in [`ICON_FONT`]. /// - /// [`ICON_FONT`]: #associatedconst.ICON_FONT + /// [`ICON_FONT`]: Self::ICON_FONT const ARROW_DOWN_ICON: char; /// Returns the default size of text. diff --git a/graphics/src/font.rs b/graphics/src/font.rs index 5c62681c..d55d0faf 100644 --- a/graphics/src/font.rs +++ b/graphics/src/font.rs @@ -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. -/// -/// [`ICONS`]: const.ICONS.html #[cfg(feature = "font-icons")] #[cfg_attr(docsrs, doc(cfg(feature = "font-icons")))] pub const CHECKMARK_ICON: char = '\u{F00C}'; /// The `char` representing a ▼ icon in the built-in [`ICONS`] font. -/// -/// [`ICONS`]: const.ICONS.html #[cfg(feature = "font-icons")] pub const ARROW_DOWN_ICON: char = '\u{E800}'; diff --git a/graphics/src/font/source.rs b/graphics/src/font/source.rs index 917291ff..a2d3f51d 100644 --- a/graphics/src/font/source.rs +++ b/graphics/src/font/source.rs @@ -8,8 +8,6 @@ pub struct Source { impl Source { /// Creates a new [`Source`]. - /// - /// [`Source`]: struct.Source.html pub fn new() -> Self { Source { raw: font_kit::source::SystemSource::new(), @@ -17,8 +15,6 @@ impl Source { } /// 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> { let font = self.raw.select_best_match( families, diff --git a/graphics/src/layer.rs b/graphics/src/layer.rs index 038c93ff..ab40b114 100644 --- a/graphics/src/layer.rs +++ b/graphics/src/layer.rs @@ -11,35 +11,23 @@ use crate::{ #[derive(Debug, Clone)] pub struct Layer<'a> { /// The clipping bounds of the [`Layer`]. - /// - /// [`Layer`]: struct.Layer.html pub bounds: Rectangle, /// The quads of the [`Layer`]. - /// - /// [`Layer`]: struct.Layer.html pub quads: Vec<Quad>, /// The triangle meshes of the [`Layer`]. - /// - /// [`Layer`]: struct.Layer.html pub meshes: Vec<Mesh<'a>>, /// The text of the [`Layer`]. - /// - /// [`Layer`]: struct.Layer.html pub text: Vec<Text<'a>>, /// The images of the [`Layer`]. - /// - /// [`Layer`]: struct.Layer.html pub images: Vec<Image>, } impl<'a> Layer<'a> { /// Creates a new [`Layer`] with the given clipping bounds. - /// - /// [`Layer`]: struct.Layer.html pub fn new(bounds: Rectangle) -> Self { Self { bounds, @@ -53,8 +41,6 @@ impl<'a> Layer<'a> { /// Creates a new [`Layer`] for the provided overlay text. /// /// This can be useful for displaying debug information. - /// - /// [`Layer`]: struct.Layer.html pub fn overlay(lines: &'a [impl AsRef<str>], viewport: &Viewport) -> Self { let mut overlay = 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 /// on its contents. - /// - /// [`Primitive`]: ../enum.Primitive.html pub fn generate( primitive: &'a Primitive, viewport: &Viewport, @@ -243,33 +227,21 @@ impl<'a> Layer<'a> { #[repr(C)] pub struct Quad { /// The position of the [`Quad`]. - /// - /// [`Quad`]: struct.Quad.html pub position: [f32; 2], /// The size of the [`Quad`]. - /// - /// [`Quad`]: struct.Quad.html pub size: [f32; 2], /// The color of the [`Quad`], in __linear RGB__. - /// - /// [`Quad`]: struct.Quad.html pub color: [f32; 4], /// The border color of the [`Quad`], in __linear RGB__. - /// - /// [`Quad`]: struct.Quad.html pub border_color: [f32; 4], /// The border radius of the [`Quad`]. - /// - /// [`Quad`]: struct.Quad.html pub border_radius: f32, /// The border width of the [`Quad`]. - /// - /// [`Quad`]: struct.Quad.html pub border_width: f32, } @@ -277,18 +249,12 @@ pub struct Quad { #[derive(Debug, Clone, Copy)] pub struct Mesh<'a> { /// The origin of the vertices of the [`Mesh`]. - /// - /// [`Mesh`]: struct.Mesh.html pub origin: Point, /// The vertex and index buffers of the [`Mesh`]. - /// - /// [`Mesh`]: struct.Mesh.html pub buffers: &'a triangle::Mesh2D, /// The clipping bounds of the [`Mesh`]. - /// - /// [`Mesh`]: struct.Mesh.html pub clip_bounds: Rectangle<f32>, } @@ -296,38 +262,24 @@ pub struct Mesh<'a> { #[derive(Debug, Clone, Copy)] pub struct Text<'a> { /// The content of the [`Text`]. - /// - /// [`Text`]: struct.Text.html pub content: &'a str, /// The layout bounds of the [`Text`]. - /// - /// [`Text`]: struct.Text.html pub bounds: Rectangle, /// The color of the [`Text`], in __linear RGB_. - /// - /// [`Text`]: struct.Text.html pub color: [f32; 4], /// The size of the [`Text`]. - /// - /// [`Text`]: struct.Text.html pub size: f32, /// The font of the [`Text`]. - /// - /// [`Text`]: struct.Text.html pub font: Font, /// The horizontal alignment of the [`Text`]. - /// - /// [`Text`]: struct.Text.html pub horizontal_alignment: HorizontalAlignment, /// The vertical alignment of the [`Text`]. - /// - /// [`Text`]: struct.Text.html pub vertical_alignment: VerticalAlignment, } diff --git a/graphics/src/renderer.rs b/graphics/src/renderer.rs index ae5038db..fa63991b 100644 --- a/graphics/src/renderer.rs +++ b/graphics/src/renderer.rs @@ -13,25 +13,16 @@ pub struct Renderer<B: Backend> { impl<B: Backend> Renderer<B> { /// Creates a new [`Renderer`] from the given [`Backend`]. - /// - /// [`Renderer`]: struct.Renderer.html - /// [`Backend`]: backend/trait.Backend.html pub fn new(backend: B) -> Self { Self { backend } } /// Returns a reference to the [`Backend`] of the [`Renderer`]. - /// - /// [`Renderer`]: struct.Renderer.html - /// [`Backend`]: backend/trait.Backend.html pub fn backend(&self) -> &B { &self.backend } /// 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 { &mut self.backend } diff --git a/graphics/src/triangle.rs b/graphics/src/triangle.rs index eb1494b1..05028f51 100644 --- a/graphics/src/triangle.rs +++ b/graphics/src/triangle.rs @@ -2,8 +2,6 @@ use bytemuck::{Pod, Zeroable}; /// A set of [`Vertex2D`] and indices representing a list of triangles. -/// -/// [`Vertex2D`]: struct.Vertex2D.html #[derive(Clone, Debug)] pub struct Mesh2D { /// The vertices of the mesh diff --git a/graphics/src/viewport.rs b/graphics/src/viewport.rs index bc7c5807..78d539af 100644 --- a/graphics/src/viewport.rs +++ b/graphics/src/viewport.rs @@ -12,8 +12,6 @@ pub struct Viewport { impl Viewport { /// Creates a new [`Viewport`] with the given physical dimensions and scale /// factor. - /// - /// [`Viewport`]: struct.Viewport.html pub fn with_physical_size(size: Size<u32>, scale_factor: f64) -> Viewport { Viewport { physical_size: size, @@ -27,43 +25,31 @@ impl Viewport { } /// Returns the physical size of the [`Viewport`]. - /// - /// [`Viewport`]: struct.Viewport.html pub fn physical_size(&self) -> Size<u32> { self.physical_size } /// Returns the physical width of the [`Viewport`]. - /// - /// [`Viewport`]: struct.Viewport.html pub fn physical_width(&self) -> u32 { self.physical_size.height } /// Returns the physical height of the [`Viewport`]. - /// - /// [`Viewport`]: struct.Viewport.html pub fn physical_height(&self) -> u32 { self.physical_size.height } /// Returns the logical size of the [`Viewport`]. - /// - /// [`Viewport`]: struct.Viewport.html pub fn logical_size(&self) -> Size<f32> { self.logical_size } /// Returns the scale factor of the [`Viewport`]. - /// - /// [`Viewport`]: struct.Viewport.html pub fn scale_factor(&self) -> f64 { self.scale_factor } /// Returns the projection transformation of the [`Viewport`]. - /// - /// [`Viewport`]: struct.Viewport.html pub fn projection(&self) -> Transformation { self.projection } diff --git a/graphics/src/widget/button.rs b/graphics/src/widget/button.rs index 87581175..2e3f78ca 100644 --- a/graphics/src/widget/button.rs +++ b/graphics/src/widget/button.rs @@ -1,9 +1,6 @@ //! Allow your users to perform actions by pressing a button. //! //! A [`Button`] has some local [`State`]. -//! -//! [`Button`]: type.Button.html -//! [`State`]: struct.State.html use crate::defaults::{self, Defaults}; use crate::{Backend, Primitive, Renderer}; use iced_native::mouse; diff --git a/graphics/src/widget/canvas.rs b/graphics/src/widget/canvas.rs index ae0d87a4..95ede50f 100644 --- a/graphics/src/widget/canvas.rs +++ b/graphics/src/widget/canvas.rs @@ -3,9 +3,6 @@ //! 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, //! and more! -//! -//! [`Canvas`]: struct.Canvas.html -//! [`Frame`]: struct.Frame.html use crate::{Backend, Defaults, Primitive, Renderer}; use iced_native::layout; use iced_native::mouse; @@ -41,8 +38,6 @@ pub use text::Text; /// A widget capable of drawing 2D graphics. /// -/// [`Canvas`]: struct.Canvas.html -/// /// # Examples /// The repository has a couple of [examples] showcasing how to use a /// [`Canvas`]: @@ -108,8 +103,6 @@ impl<Message, P: Program<Message>> Canvas<Message, P> { const DEFAULT_SIZE: u16 = 100; /// Creates a new [`Canvas`]. - /// - /// [`Canvas`]: struct.Canvas.html pub fn new(program: P) -> Self { Canvas { width: Length::Units(Self::DEFAULT_SIZE), @@ -120,16 +113,12 @@ impl<Message, P: Program<Message>> Canvas<Message, P> { } /// Sets the width of the [`Canvas`]. - /// - /// [`Canvas`]: struct.Canvas.html pub fn width(mut self, width: Length) -> Self { self.width = width; self } /// Sets the height of the [`Canvas`]. - /// - /// [`Canvas`]: struct.Canvas.html pub fn height(mut self, height: Length) -> Self { self.height = height; self diff --git a/graphics/src/widget/canvas/cache.rs b/graphics/src/widget/canvas/cache.rs index 4b28d164..a469417d 100644 --- a/graphics/src/widget/canvas/cache.rs +++ b/graphics/src/widget/canvas/cache.rs @@ -23,10 +23,6 @@ impl Default for State { /// /// A [`Cache`] will not redraw its geometry unless the dimensions of its layer /// change or it is explicitly cleared. -/// -/// [`Layer`]: ../trait.Layer.html -/// [`Cache`]: struct.Cache.html -/// [`Geometry`]: struct.Geometry.html #[derive(Debug, Default)] pub struct Cache { state: RefCell<State>, @@ -34,8 +30,6 @@ pub struct Cache { impl Cache { /// Creates a new empty [`Cache`]. - /// - /// [`Cache`]: struct.Cache.html pub fn new() -> Self { Cache { state: Default::default(), @@ -43,8 +37,6 @@ impl Cache { } /// Clears the [`Cache`], forcing a redraw the next time it is used. - /// - /// [`Cache`]: struct.Cache.html pub fn clear(&mut self) { *self.state.borrow_mut() = State::Empty; } @@ -59,8 +51,6 @@ impl Cache { /// Otherwise, the previously stored [`Geometry`] will be returned. The /// [`Cache`] is not cleared in this case. In other words, it will keep /// returning the stored [`Geometry`] if needed. - /// - /// [`Cache`]: struct.Cache.html pub fn draw(&self, bounds: Size, draw_fn: impl Fn(&mut Frame)) -> Geometry { use std::ops::Deref; diff --git a/graphics/src/widget/canvas/cursor.rs b/graphics/src/widget/canvas/cursor.rs index 456760ea..9588d129 100644 --- a/graphics/src/widget/canvas/cursor.rs +++ b/graphics/src/widget/canvas/cursor.rs @@ -22,8 +22,6 @@ impl Cursor { } /// Returns the absolute position of the [`Cursor`], if available. - /// - /// [`Cursor`]: enum.Cursor.html pub fn position(&self) -> Option<Point> { match self { Cursor::Available(position) => Some(*position), @@ -36,8 +34,6 @@ impl Cursor { /// /// If the [`Cursor`] is not over the provided bounds, this method will /// return `None`. - /// - /// [`Cursor`]: enum.Cursor.html pub fn position_in(&self, bounds: &Rectangle) -> Option<Point> { if self.is_over(bounds) { self.position_from(bounds.position()) @@ -48,8 +44,6 @@ impl Cursor { /// Returns the relative position of the [`Cursor`] from the given origin, /// if available. - /// - /// [`Cursor`]: enum.Cursor.html pub fn position_from(&self, origin: Point) -> Option<Point> { match self { Cursor::Available(position) => { @@ -61,8 +55,6 @@ impl Cursor { /// Returns whether the [`Cursor`] is currently over the provided bounds /// or not. - /// - /// [`Cursor`]: enum.Cursor.html pub fn is_over(&self, bounds: &Rectangle) -> bool { match self { Cursor::Available(position) => bounds.contains(*position), diff --git a/graphics/src/widget/canvas/event.rs b/graphics/src/widget/canvas/event.rs index ede2fd73..5bf6f7a6 100644 --- a/graphics/src/widget/canvas/event.rs +++ b/graphics/src/widget/canvas/event.rs @@ -6,7 +6,7 @@ pub use iced_native::event::Status; /// A [`Canvas`] event. /// -/// [`Canvas`]: struct.Event.html +/// [`Canvas`]: crate::widget::Canvas #[derive(Debug, Clone, Copy, PartialEq)] pub enum Event { /// A mouse event. diff --git a/graphics/src/widget/canvas/frame.rs b/graphics/src/widget/canvas/frame.rs index 21e9ec28..b86f9e04 100644 --- a/graphics/src/widget/canvas/frame.rs +++ b/graphics/src/widget/canvas/frame.rs @@ -7,7 +7,7 @@ use crate::{ /// The frame of a [`Canvas`]. /// -/// [`Canvas`]: struct.Canvas.html +/// [`Canvas`]: crate::widget::Canvas #[derive(Debug)] pub struct Frame { size: Size, @@ -33,8 +33,6 @@ impl Frame { /// /// The default coordinate system of a [`Frame`] has its origin at the /// top-left corner of its bounds. - /// - /// [`Frame`]: struct.Frame.html pub fn new(size: Size) -> Frame { Frame { size, @@ -51,32 +49,24 @@ impl Frame { } /// Returns the width of the [`Frame`]. - /// - /// [`Frame`]: struct.Frame.html #[inline] pub fn width(&self) -> f32 { self.size.width } /// Returns the width of the [`Frame`]. - /// - /// [`Frame`]: struct.Frame.html #[inline] pub fn height(&self) -> f32 { self.size.height } /// Returns the dimensions of the [`Frame`]. - /// - /// [`Frame`]: struct.Frame.html #[inline] pub fn size(&self) -> Size { self.size } /// Returns the coordinate of the center of the [`Frame`]. - /// - /// [`Frame`]: struct.Frame.html #[inline] pub fn center(&self) -> Point { 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 /// provided style. - /// - /// [`Path`]: path/struct.Path.html - /// [`Frame`]: struct.Frame.html pub fn fill(&mut self, path: &Path, fill: impl Into<Fill>) { use lyon::tessellation::{ BuffersBuilder, FillOptions, FillTessellator, @@ -115,8 +102,6 @@ impl Frame { /// Draws an axis-aligned rectangle given its top-left corner coordinate and /// its `Size` on the [`Frame`] by filling it with the provided style. - /// - /// [`Frame`]: struct.Frame.html pub fn fill_rectangle( &mut self, top_left: Point, @@ -152,9 +137,6 @@ impl Frame { /// Draws the stroke of the given [`Path`] on the [`Frame`] with the /// provided style. - /// - /// [`Path`]: path/struct.Path.html - /// [`Frame`]: struct.Frame.html pub fn stroke(&mut self, path: &Path, stroke: impl Into<Stroke>) { use lyon::tessellation::{ BuffersBuilder, StrokeOptions, StrokeTessellator, @@ -200,9 +182,7 @@ impl Frame { /// Support for vectorial text is planned, and should address all these /// limitations. /// - /// [`Text`]: struct.Text.html - /// [`Frame`]: struct.Frame.html - /// [`Canvas`]: struct.Canvas.html + /// [`Canvas`]: crate::widget::Canvas pub fn fill_text(&mut self, text: impl Into<Text>) { use std::f32; @@ -240,8 +220,6 @@ impl Frame { /// /// This method is useful to compose transforms and perform drawing /// operations in different coordinate systems. - /// - /// [`Frame`]: struct.Frame.html #[inline] pub fn with_save(&mut self, f: impl FnOnce(&mut Frame)) { self.transforms.previous.push(self.transforms.current); @@ -252,8 +230,6 @@ impl Frame { } /// Applies a translation to the current transform of the [`Frame`]. - /// - /// [`Frame`]: struct.Frame.html #[inline] pub fn translate(&mut self, translation: Vector) { self.transforms.current.raw = self @@ -268,8 +244,6 @@ impl Frame { } /// Applies a rotation to the current transform of the [`Frame`]. - /// - /// [`Frame`]: struct.Frame.html #[inline] pub fn rotate(&mut self, angle: f32) { self.transforms.current.raw = self @@ -281,8 +255,6 @@ impl Frame { } /// Applies a scaling to the current transform of the [`Frame`]. - /// - /// [`Frame`]: struct.Frame.html #[inline] pub fn scale(&mut self, scale: f32) { self.transforms.current.raw = @@ -291,9 +263,6 @@ impl 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 { if !self.buffers.indices.is_empty() { self.primitives.push(Primitive::Mesh2D { diff --git a/graphics/src/widget/canvas/geometry.rs b/graphics/src/widget/canvas/geometry.rs index 4cadee39..8915cda1 100644 --- a/graphics/src/widget/canvas/geometry.rs +++ b/graphics/src/widget/canvas/geometry.rs @@ -5,9 +5,8 @@ use crate::Primitive; /// [`Geometry`] can be easily generated with a [`Frame`] or stored in a /// [`Cache`]. /// -/// [`Geometry`]: struct.Geometry.html -/// [`Frame`]: struct.Frame.html -/// [`Cache`]: struct.Cache.html +/// [`Frame`]: crate::widget::canvas::Frame +/// [`Cache`]: crate::widget::canvas::Cache #[derive(Debug, Clone)] pub struct Geometry(Primitive); @@ -19,9 +18,6 @@ impl Geometry { /// Turns the [`Geometry`] into a [`Primitive`]. /// /// 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 { self.0 } diff --git a/graphics/src/widget/canvas/path.rs b/graphics/src/widget/canvas/path.rs index c26bf187..6de19321 100644 --- a/graphics/src/widget/canvas/path.rs +++ b/graphics/src/widget/canvas/path.rs @@ -12,8 +12,6 @@ use iced_native::{Point, Size}; /// An immutable set of points that may or may not be connected. /// /// A single [`Path`] can represent different kinds of 2D shapes! -/// -/// [`Path`]: struct.Path.html #[derive(Debug, Clone)] pub struct Path { raw: lyon::path::Path, @@ -23,9 +21,6 @@ impl Path { /// Creates a new [`Path`] with the provided closure. /// /// Use the [`Builder`] to configure your [`Path`]. - /// - /// [`Path`]: struct.Path.html - /// [`Builder`]: struct.Builder.html pub fn new(f: impl FnOnce(&mut Builder)) -> Self { let mut builder = Builder::new(); @@ -37,8 +32,6 @@ impl Path { /// Creates a new [`Path`] representing a line segment given its starting /// and end points. - /// - /// [`Path`]: struct.Path.html pub fn line(from: Point, to: Point) -> Self { Self::new(|p| { p.move_to(from); @@ -48,16 +41,12 @@ impl Path { /// Creates a new [`Path`] representing a rectangle given its top-left /// corner coordinate and its `Size`. - /// - /// [`Path`]: struct.Path.html pub fn rectangle(top_left: Point, size: Size) -> Self { Self::new(|p| p.rectangle(top_left, size)) } /// Creates a new [`Path`] representing a circle given its center /// coordinate and its radius. - /// - /// [`Path`]: struct.Path.html pub fn circle(center: Point, radius: f32) -> Self { Self::new(|p| p.circle(center, radius)) } diff --git a/graphics/src/widget/canvas/path/arc.rs b/graphics/src/widget/canvas/path/arc.rs index 343191f1..b8e72daf 100644 --- a/graphics/src/widget/canvas/path/arc.rs +++ b/graphics/src/widget/canvas/path/arc.rs @@ -15,8 +15,6 @@ pub struct Arc { } /// An elliptical [`Arc`]. -/// -/// [`Arc`]: struct.Arc.html #[derive(Debug, Clone, Copy)] pub struct Elliptical { /// The center of the arc. diff --git a/graphics/src/widget/canvas/path/builder.rs b/graphics/src/widget/canvas/path/builder.rs index e0e52845..5ce0e02c 100644 --- a/graphics/src/widget/canvas/path/builder.rs +++ b/graphics/src/widget/canvas/path/builder.rs @@ -6,8 +6,6 @@ use lyon::path::builder::{Build, FlatPathBuilder, PathBuilder, SvgBuilder}; /// A [`Path`] builder. /// /// Once a [`Path`] is built, it can no longer be mutated. -/// -/// [`Path`]: struct.Path.html #[allow(missing_debug_implementations)] pub struct Builder { raw: lyon::path::builder::SvgPathBuilder<lyon::path::Builder>, @@ -15,8 +13,6 @@ pub struct Builder { impl Builder { /// Creates a new [`Builder`]. - /// - /// [`Builder`]: struct.Builder.html pub fn new() -> Builder { Builder { 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 /// straight line. - /// - /// [`Path`]: struct.Path.html #[inline] pub fn line_to(&mut self, point: Point) { 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 /// a clockwise direction. - /// - /// [`Arc`]: struct.Arc.html - /// [`Path`]: struct.Path.html #[inline] pub fn arc(&mut self, arc: Arc) { self.ellipse(arc.into()); @@ -53,8 +44,6 @@ impl Builder { /// /// The arc is connected to the previous point by a straight line, if /// necessary. - /// - /// [`Path`]: struct.Path.html pub fn arc_to(&mut self, a: Point, b: Point, radius: f32) { use lyon::{math, path}; @@ -72,10 +61,7 @@ impl Builder { ); } - /// Adds an [`Ellipse`] to the [`Path`] using a clockwise direction. - /// - /// [`Ellipse`]: struct.Arc.html - /// [`Path`]: struct.Path.html + /// Adds an ellipse to the [`Path`] using a clockwise direction. pub fn ellipse(&mut self, arc: arc::Elliptical) { use lyon::{geom, math}; @@ -96,8 +82,6 @@ impl Builder { /// Adds a cubic Bézier curve to the [`Path`] given its two control points /// and its end point. - /// - /// [`Path`]: struct.Path.html #[inline] pub fn bezier_curve_to( &mut self, @@ -116,8 +100,6 @@ impl Builder { /// Adds a quadratic Bézier curve to the [`Path`] given its control point /// and its end point. - /// - /// [`Path`]: struct.Path.html #[inline] pub fn quadratic_curve_to(&mut self, control: Point, to: Point) { use lyon::math; @@ -130,8 +112,6 @@ impl Builder { /// Adds a rectangle to the [`Path`] given its top-left corner coordinate /// and its `Size`. - /// - /// [`Path`]: struct.Path.html #[inline] pub fn rectangle(&mut self, top_left: Point, size: Size) { self.move_to(top_left); @@ -146,8 +126,6 @@ impl Builder { /// Adds a circle to the [`Path`] given its center coordinate and its /// radius. - /// - /// [`Path`]: struct.Path.html #[inline] pub fn circle(&mut self, center: Point, radius: f32) { self.arc(Arc { @@ -160,17 +138,12 @@ impl Builder { /// Closes the current sub-path in the [`Path`] with a straight line to /// the starting point. - /// - /// [`Path`]: struct.Path.html #[inline] pub fn close(&mut self) { self.raw.close() } /// Builds the [`Path`] of this [`Builder`]. - /// - /// [`Path`]: struct.Path.html - /// [`Builder`]: struct.Builder.html #[inline] pub fn build(self) -> Path { Path { diff --git a/graphics/src/widget/canvas/program.rs b/graphics/src/widget/canvas/program.rs index e8f43380..d703caad 100644 --- a/graphics/src/widget/canvas/program.rs +++ b/graphics/src/widget/canvas/program.rs @@ -7,8 +7,7 @@ use iced_native::{mouse, Rectangle}; /// A [`Program`] can mutate internal state and produce messages for an /// application. /// -/// [`Canvas`]: struct.Canvas.html -/// [`Program`]: trait.Program.html +/// [`Canvas`]: crate::widget::Canvas pub trait Program<Message> { /// Updates the state of the [`Program`]. /// @@ -20,9 +19,7 @@ pub trait Program<Message> { /// /// By default, this method does and returns nothing. /// - /// [`Program`]: trait.Program.html - /// [`Canvas`]: struct.Canvas.html - /// [`Event`]: enum.Event.html + /// [`Canvas`]: crate::widget::Canvas fn update( &mut self, _event: Event, @@ -37,10 +34,8 @@ pub trait Program<Message> { /// [`Geometry`] can be easily generated with a [`Frame`] or stored in a /// [`Cache`]. /// - /// [`Program`]: trait.Program.html - /// [`Geometry`]: struct.Geometry.html - /// [`Frame`]: struct.Frame.html - /// [`Cache`]: struct.Cache.html + /// [`Frame`]: crate::widget::canvas::Cache + /// [`Cache`]: crate::widget::canvas::Cache fn draw(&self, bounds: Rectangle, cursor: Cursor) -> Vec<Geometry>; /// 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 /// is out of bounds of the program's [`Canvas`]. /// - /// [`Program`]: trait.Program.html - /// [`Canvas`]: struct.Canvas.html + /// [`Canvas`]: crate::widget::Canvas fn mouse_interaction( &self, _bounds: Rectangle, diff --git a/graphics/src/widget/canvas/stroke.rs b/graphics/src/widget/canvas/stroke.rs index 5b6fc56a..9f0449d0 100644 --- a/graphics/src/widget/canvas/stroke.rs +++ b/graphics/src/widget/canvas/stroke.rs @@ -16,31 +16,21 @@ pub struct Stroke { impl Stroke { /// Sets the color of the [`Stroke`]. - /// - /// [`Stroke`]: struct.Stroke.html pub fn with_color(self, color: Color) -> Stroke { Stroke { color, ..self } } /// Sets the width of the [`Stroke`]. - /// - /// [`Stroke`]: struct.Stroke.html pub fn with_width(self, width: f32) -> Stroke { Stroke { width, ..self } } /// Sets the [`LineCap`] of the [`Stroke`]. - /// - /// [`LineCap`]: enum.LineCap.html - /// [`Stroke`]: struct.Stroke.html pub fn with_line_cap(self, line_cap: LineCap) -> Stroke { Stroke { line_cap, ..self } } /// Sets the [`LineJoin`] of the [`Stroke`]. - /// - /// [`LineJoin`]: enum.LineJoin.html - /// [`Stroke`]: struct.Stroke.html pub fn with_line_join(self, line_join: LineJoin) -> Stroke { Stroke { line_join, ..self } } diff --git a/graphics/src/widget/pane_grid.rs b/graphics/src/widget/pane_grid.rs index 72a380e4..a21d4d94 100644 --- a/graphics/src/widget/pane_grid.rs +++ b/graphics/src/widget/pane_grid.rs @@ -7,7 +7,6 @@ //! drag and drop, and hotkey support. //! //! [`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::defaults; use crate::{Primitive, Renderer}; diff --git a/graphics/src/widget/progress_bar.rs b/graphics/src/widget/progress_bar.rs index c1801a41..932f4fc2 100644 --- a/graphics/src/widget/progress_bar.rs +++ b/graphics/src/widget/progress_bar.rs @@ -2,8 +2,6 @@ //! //! A [`ProgressBar`] has a range of possible values and a current value, //! as well as a length, height and style. -//! -//! [`ProgressBar`]: type.ProgressBar.html use crate::{Backend, Primitive, Renderer}; use iced_native::mouse; use iced_native::progress_bar; diff --git a/graphics/src/widget/slider.rs b/graphics/src/widget/slider.rs index 051e18b8..9a4af9ac 100644 --- a/graphics/src/widget/slider.rs +++ b/graphics/src/widget/slider.rs @@ -1,9 +1,6 @@ //! Display an interactive selector of a single value from a range of values. //! //! A [`Slider`] has some local [`State`]. -//! -//! [`Slider`]: struct.Slider.html -//! [`State`]: struct.State.html use crate::{Backend, Primitive, Renderer}; use iced_native::mouse; use iced_native::slider; diff --git a/graphics/src/widget/text_input.rs b/graphics/src/widget/text_input.rs index 55eb34e4..c269022b 100644 --- a/graphics/src/widget/text_input.rs +++ b/graphics/src/widget/text_input.rs @@ -1,9 +1,6 @@ //! Display fields that can be filled with text. //! //! A [`TextInput`] has some local [`State`]. -//! -//! [`TextInput`]: struct.TextInput.html -//! [`State`]: struct.State.html use crate::backend::{self, Backend}; use crate::{Primitive, Renderer}; use iced_native::mouse; diff --git a/graphics/src/window/compositor.rs b/graphics/src/window/compositor.rs index 7674f227..0bc8cbc8 100644 --- a/graphics/src/window/compositor.rs +++ b/graphics/src/window/compositor.rs @@ -16,14 +16,12 @@ pub trait Compositor: Sized { /// The swap chain of the backend. type SwapChain; - /// Creates a new [`Backend`]. - /// - /// [`Backend`]: trait.Backend.html + /// Creates a new [`Compositor`]. fn new(settings: Self::Settings) -> Result<(Self, Self::Renderer), Error>; /// Crates a new [`Surface`] for the given window. /// - /// [`Surface`]: #associatedtype.Surface + /// [`Surface`]: Self::Surface fn create_surface<W: HasRawWindowHandle>( &mut self, window: &W, @@ -31,8 +29,8 @@ pub trait Compositor: Sized { /// Crates a new [`SwapChain`] for the given [`Surface`]. /// - /// [`SwapChain`]: #associatedtype.SwapChain - /// [`Surface`]: #associatedtype.Surface + /// [`SwapChain`]: Self::SwapChain + /// [`Surface`]: Self::Surface fn create_swap_chain( &mut self, surface: &Self::Surface, @@ -42,8 +40,7 @@ pub trait Compositor: Sized { /// Draws the output primitives to the next frame of the given [`SwapChain`]. /// - /// [`SwapChain`]: #associatedtype.SwapChain - /// [`Surface`]: #associatedtype.Surface + /// [`SwapChain`]: Self::SwapChain fn draw<T: AsRef<str>>( &mut self, renderer: &mut Self::Renderer, diff --git a/graphics/src/window/gl_compositor.rs b/graphics/src/window/gl_compositor.rs index 1f37642e..34d70be3 100644 --- a/graphics/src/window/gl_compositor.rs +++ b/graphics/src/window/gl_compositor.rs @@ -15,28 +15,27 @@ use core::ffi::c_void; /// If you implement an OpenGL renderer, you can implement this trait to ease /// integration with existing windowing shells, like `iced_glutin`. pub trait GLCompositor: Sized { - /// The renderer of the [`Compositor`]. + /// The renderer of the [`GLCompositor`]. /// /// This should point to your renderer type, which could be a type alias /// of the [`Renderer`] provided in this crate with with a specific /// [`Backend`]. /// - /// [`Compositor`]: trait.Compositor.html - /// [`Renderer`]: ../struct.Renderer.html - /// [`Backend`]: ../backend/trait.Backend.html + /// [`Renderer`]: crate::Renderer + /// [`Backend`]: crate::Backend type Renderer: iced_native::Renderer; - /// The settings of the [`Compositor`]. + /// The settings of the [`GLCompositor`]. /// /// It's up to you to decide the configuration supported by your renderer! type Settings: Default; - /// Creates a new [`Compositor`] and [`Renderer`] with the given + /// Creates a new [`GLCompositor`] and [`Renderer`] with the given /// [`Settings`] and an OpenGL address loader function. /// - /// [`Compositor`]: trait.Compositor.html - /// [`Renderer`]: #associatedtype.Renderer - /// [`Backend`]: ../backend/trait.Backend.html + /// [`Renderer`]: crate::Renderer + /// [`Backend`]: crate::Backend + /// [`Settings`]: Self::Settings #[allow(unsafe_code)] unsafe fn new( settings: Self::Settings, @@ -44,19 +43,15 @@ pub trait GLCompositor: Sized { ) -> Result<(Self, Self::Renderer), Error>; /// Returns the amount of samples that should be used when configuring - /// an OpenGL context for this [`Compositor`]. - /// - /// [`Compositor`]: trait.Compositor.html + /// an OpenGL context for this [`GLCompositor`]. fn sample_count(settings: &Self::Settings) -> u32; - /// Resizes the viewport of the [`Compositor`]. - /// - /// [`Compositor`]: trait.Compositor.html + /// Resizes the viewport of the [`GLCompositor`]. fn resize_viewport(&mut self, physical_size: Size<u32>); /// Draws the provided output with the given [`Renderer`]. /// - /// [`Compositor`]: trait.Compositor.html + /// [`Renderer`]: crate::Renderer fn draw<T: AsRef<str>>( &mut self, renderer: &mut Self::Renderer, |