diff options
Diffstat (limited to 'native')
48 files changed, 73 insertions, 913 deletions
diff --git a/native/src/clipboard.rs b/native/src/clipboard.rs index 4c574590..ecdccabf 100644 --- a/native/src/clipboard.rs +++ b/native/src/clipboard.rs @@ -2,7 +2,5 @@ /// applications. pub trait Clipboard { /// Returns the current content of the [`Clipboard`] as text. - /// - /// [`Clipboard`]: trait.Clipboard.html fn content(&self) -> Option<String>; } diff --git a/native/src/debug/basic.rs b/native/src/debug/basic.rs index 8a712038..a42f66ea 100644 --- a/native/src/debug/basic.rs +++ b/native/src/debug/basic.rs @@ -32,9 +32,7 @@ pub struct Debug { } impl Debug { - /// Creates a new [`Debug`]. - /// - /// [`Debug`]: struct.Debug.html + /// Creates a new [`struct@Debug`]. pub fn new() -> Self { let now = time::Instant::now(); diff --git a/native/src/element.rs b/native/src/element.rs index 9703a7db..d6e9639a 100644 --- a/native/src/element.rs +++ b/native/src/element.rs @@ -14,8 +14,6 @@ use crate::{ /// to turn it into an [`Element`]. /// /// [built-in widget]: widget/index.html#built-in-widgets -/// [`Widget`]: widget/trait.Widget.html -/// [`Element`]: struct.Element.html #[allow(missing_debug_implementations)] pub struct Element<'a, Message, Renderer> { pub(crate) widget: Box<dyn Widget<Message, Renderer> + 'a>, @@ -26,9 +24,6 @@ where Renderer: crate::Renderer, { /// Creates a new [`Element`] containing the given [`Widget`]. - /// - /// [`Element`]: struct.Element.html - /// [`Widget`]: widget/trait.Widget.html pub fn new( widget: impl Widget<Message, Renderer> + 'a, ) -> Element<'a, Message, Renderer> { @@ -42,8 +37,6 @@ where /// This method is useful when you want to decouple different parts of your /// UI and make them __composable__. /// - /// [`Element`]: struct.Element.html - /// /// # Example /// 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 @@ -189,8 +182,7 @@ where /// The [`Renderer`] will explain the layout of the [`Element`] graphically. /// This can be very useful for debugging your layout! /// - /// [`Element`]: struct.Element.html - /// [`Renderer`]: trait.Renderer.html + /// [`Renderer`]: crate::Renderer pub fn explain<C: Into<Color>>( self, color: C, @@ -205,23 +197,18 @@ where } /// Returns the width of the [`Element`]. - /// - /// [`Element`]: struct.Element.html pub fn width(&self) -> Length { self.widget.width() } /// Returns the height of the [`Element`]. - /// - /// [`Element`]: struct.Element.html pub fn height(&self) -> Length { self.widget.height() } /// Computes the layout of the [`Element`] in the given [`Limits`]. /// - /// [`Element`]: struct.Element.html - /// [`Limits`]: layout/struct.Limits.html + /// [`Limits`]: layout::Limits pub fn layout( &self, renderer: &Renderer, @@ -231,8 +218,6 @@ where } /// Processes a runtime [`Event`]. - /// - /// [`Event`]: enum.Event.html pub fn on_event( &mut self, event: Event, @@ -253,9 +238,6 @@ where } /// Draws the [`Element`] and its children using the given [`Layout`]. - /// - /// [`Element`]: struct.Element.html - /// [`Layout`]: layout/struct.Layout.html pub fn draw( &self, renderer: &mut Renderer, @@ -269,15 +251,11 @@ where } /// Computes the _layout_ hash of the [`Element`]. - /// - /// [`Element`]: struct.Element.html pub fn hash_layout(&self, state: &mut Hasher) { self.widget.hash_layout(state); } /// Returns the overlay of the [`Element`], if there is any. - /// - /// [`Element`]: struct.Element.html pub fn overlay<'b>( &'b mut self, layout: Layout<'_>, diff --git a/native/src/event.rs b/native/src/event.rs index 9c079151..0e86171e 100644 --- a/native/src/event.rs +++ b/native/src/event.rs @@ -20,19 +20,12 @@ pub enum Event { } /// The status of an [`Event`] after being processed. -/// -/// [`Event`]: enum.Event.html -/// [`UserInterface`]: ../struct.UserInterface.html #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Status { /// The [`Event`] was **NOT** handled by any widget. - /// - /// [`Event`]: enum.Event.html Ignored, /// The [`Event`] was handled and processed by a widget. - /// - /// [`Event`]: enum.Event.html Captured, } diff --git a/native/src/layout.rs b/native/src/layout.rs index b7fd531c..6d144902 100644 --- a/native/src/layout.rs +++ b/native/src/layout.rs @@ -12,8 +12,6 @@ pub use node::Node; use crate::{Point, Rectangle, Vector}; /// The bounds of a [`Node`] and its children, using absolute coordinates. -/// -/// [`Node`]: struct.Node.html #[derive(Debug, Clone, Copy)] pub struct Layout<'a> { position: Point, @@ -35,8 +33,6 @@ impl<'a> Layout<'a> { } /// Returns the position of the [`Layout`]. - /// - /// [`Layout`]: struct.Layout.html pub fn position(&self) -> Point { self.position } @@ -45,10 +41,6 @@ impl<'a> Layout<'a> { /// /// The returned [`Rectangle`] describes the position and size of a /// [`Node`]. - /// - /// [`Layout`]: struct.Layout.html - /// [`Rectangle`]: struct.Rectangle.html - /// [`Node`]: struct.Node.html pub fn bounds(&self) -> Rectangle { 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`]. - /// - /// [`Layout`]: struct.Layout.html - /// [`Node`]: struct.Node.html pub fn children(self) -> impl Iterator<Item = Layout<'a>> { self.node.children().iter().map(move |node| { Layout::with_offset( diff --git a/native/src/layout/debugger.rs b/native/src/layout/debugger.rs index 4c6dd793..0759613f 100644 --- a/native/src/layout/debugger.rs +++ b/native/src/layout/debugger.rs @@ -1,8 +1,6 @@ use crate::{Color, Layout, Point, Rectangle, Renderer, Widget}; /// A renderer able to graphically explain a [`Layout`]. -/// -/// [`Layout`]: struct.Layout.html pub trait Debugger: Renderer { /// 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 /// [`Layout`] and its children. /// - /// [`Layout`]: struct.Layout.html - /// [`Element`]: ../struct.Element.html - /// [`Element::explain`]: ../struct.Element.html#method.explain + /// [`Element`]: crate::Element + /// [`Element::explain`]: crate::Element::explain fn explain<Message>( &mut self, defaults: &Self::Defaults, diff --git a/native/src/layout/flex.rs b/native/src/layout/flex.rs index 9da75a21..4f6523fb 100644 --- a/native/src/layout/flex.rs +++ b/native/src/layout/flex.rs @@ -58,8 +58,6 @@ impl Axis { /// padding and alignment to the items as needed. /// /// It returns a new layout [`Node`]. -/// -/// [`Node`]: ../struct.Node.html pub fn resolve<Message, Renderer>( axis: Axis, renderer: &Renderer, diff --git a/native/src/layout/limits.rs b/native/src/layout/limits.rs index 664c881a..a7bb5c9c 100644 --- a/native/src/layout/limits.rs +++ b/native/src/layout/limits.rs @@ -17,9 +17,6 @@ impl Limits { }; /// 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 { Limits { min, @@ -29,32 +26,21 @@ impl Limits { } /// Returns the minimum [`Size`] of the [`Limits`]. - /// - /// [`Limits`]: struct.Limits.html - /// [`Size`]: ../struct.Size.html pub fn min(&self) -> Size { self.min } /// Returns the maximum [`Size`] of the [`Limits`]. - /// - /// [`Limits`]: struct.Limits.html - /// [`Size`]: ../struct.Size.html pub fn max(&self) -> Size { self.max } /// Returns the fill [`Size`] of the [`Limits`]. - /// - /// [`Limits`]: struct.Limits.html - /// [`Size`]: ../struct.Size.html pub fn fill(&self) -> Size { self.fill } /// Applies a width constraint to the current [`Limits`]. - /// - /// [`Limits`]: struct.Limits.html pub fn width(mut self, width: Length) -> Limits { match width { Length::Shrink => { @@ -77,8 +63,6 @@ impl Limits { } /// Applies a height constraint to the current [`Limits`]. - /// - /// [`Limits`]: struct.Limits.html pub fn height(mut self, height: Length) -> Limits { match height { Length::Shrink => { @@ -101,8 +85,6 @@ impl Limits { } /// Applies a minimum width constraint to the current [`Limits`]. - /// - /// [`Limits`]: struct.Limits.html pub fn min_width(mut self, min_width: u32) -> Limits { self.min.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`]. - /// - /// [`Limits`]: struct.Limits.html pub fn max_width(mut self, max_width: u32) -> Limits { self.max.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`]. - /// - /// [`Limits`]: struct.Limits.html pub fn min_height(mut self, min_height: u32) -> Limits { self.min.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`]. - /// - /// [`Limits`]: struct.Limits.html pub fn max_height(mut self, max_height: u32) -> Limits { self.max.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. - /// - /// [`Limits`]: struct.Limits.html pub fn pad(&self, padding: f32) -> Limits { self.shrink(Size::new(padding * 2.0, padding * 2.0)) } /// Shrinks the current [`Limits`] by the given [`Size`]. - /// - /// [`Limits`]: struct.Limits.html - /// [`Size`]: ../struct.Size.html pub fn shrink(&self, size: Size) -> Limits { let min = Size::new( (self.min().width - size.width).max(0.0), @@ -171,8 +142,6 @@ impl Limits { } /// Removes the minimum width constraint for the current [`Limits`]. - /// - /// [`Limits`]: struct.Limits.html pub fn loose(&self) -> Limits { Limits { min: Size::ZERO, @@ -183,8 +152,6 @@ impl Limits { /// Computes the resulting [`Size`] that fits the [`Limits`] given the /// intrinsic size of some content. - /// - /// [`Limits`]: struct.Limits.html pub fn resolve(&self, intrinsic_size: Size) -> Size { Size::new( intrinsic_size diff --git a/native/src/layout/node.rs b/native/src/layout/node.rs index a265c46a..d7666f31 100644 --- a/native/src/layout/node.rs +++ b/native/src/layout/node.rs @@ -9,17 +9,11 @@ pub struct Node { impl Node { /// Creates a new [`Node`] with the given [`Size`]. - /// - /// [`Node`]: struct.Node.html - /// [`Size`]: ../struct.Size.html pub const fn new(size: Size) -> Self { Self::with_children(size, Vec::new()) } /// 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 { Node { bounds: Rectangle { @@ -33,30 +27,21 @@ impl Node { } /// Returns the [`Size`] of the [`Node`]. - /// - /// [`Node`]: struct.Node.html - /// [`Size`]: ../struct.Size.html pub fn size(&self) -> Size { Size::new(self.bounds.width, self.bounds.height) } /// Returns the bounds of the [`Node`]. - /// - /// [`Node`]: struct.Node.html pub fn bounds(&self) -> Rectangle { self.bounds } /// Returns the children of the [`Node`]. - /// - /// [`Node`]: struct.Node.html pub fn children(&self) -> &[Node] { &self.children } /// Aligns the [`Node`] in the given space. - /// - /// [`Node`]: struct.Node.html pub fn align( &mut self, horizontal_alignment: Align, @@ -85,8 +70,6 @@ impl Node { } /// Moves the [`Node`] to the given position. - /// - /// [`Node`]: struct.Node.html pub fn move_to(&mut self, position: Point) { self.bounds.x = position.x; self.bounds.y = position.y; diff --git a/native/src/lib.rs b/native/src/lib.rs index d1252eaf..ff355aa7 100644 --- a/native/src/lib.rs +++ b/native/src/lib.rs @@ -27,9 +27,7 @@ //! [`iced_winit`]: https://github.com/hecrj/iced/tree/master/winit //! [`druid`]: https://github.com/xi-editor/druid //! [`raw-window-handle`]: https://github.com/rust-windowing/raw-window-handle -//! [`Widget`]: widget/trait.Widget.html -//! [`UserInterface`]: struct.UserInterface.html -//! [renderer]: renderer/index.html +//! [renderer]: crate::renderer #![deny(missing_docs)] #![deny(missing_debug_implementations)] #![deny(unused_results)] diff --git a/native/src/mouse/click.rs b/native/src/mouse/click.rs index d27bc67e..6c8b61a5 100644 --- a/native/src/mouse/click.rs +++ b/native/src/mouse/click.rs @@ -36,8 +36,6 @@ impl Kind { impl Click { /// Creates a new [`Click`] with the given position and previous last /// [`Click`]. - /// - /// [`Click`]: struct.Click.html pub fn new(position: Point, previous: Option<Click>) -> Click { let time = Instant::now(); @@ -59,9 +57,6 @@ impl Click { } /// Returns the [`Kind`] of [`Click`]. - /// - /// [`Kind`]: enum.Kind.html - /// [`Click`]: struct.Click.html pub fn kind(&self) -> Kind { self.kind } diff --git a/native/src/overlay.rs b/native/src/overlay.rs index 56d055d3..ea8bb384 100644 --- a/native/src/overlay.rs +++ b/native/src/overlay.rs @@ -20,9 +20,7 @@ where /// This [`Node`] is used by the runtime to compute the [`Layout`] of the /// user interface. /// - /// [`Node`]: ../layout/struct.Node.html - /// [`Widget`]: trait.Overlay.html - /// [`Layout`]: ../layout/struct.Layout.html + /// [`Node`]: layout::Node fn layout( &self, renderer: &Renderer, @@ -31,8 +29,6 @@ where ) -> layout::Node; /// Draws the [`Overlay`] using the associated `Renderer`. - /// - /// [`Overlay`]: trait.Overlay.html fn draw( &self, renderer: &mut Renderer, @@ -51,9 +47,7 @@ where /// For example, the [`Text`] widget does not hash its color property, as /// its value cannot affect the overall [`Layout`] of the user interface. /// - /// [`Overlay`]: trait.Overlay.html - /// [`Layout`]: ../layout/struct.Layout.html - /// [`Text`]: text/struct.Text.html + /// [`Text`]: crate::widget::Text fn hash_layout(&self, state: &mut Hasher, position: Point); /// Processes a runtime [`Event`]. @@ -68,11 +62,6 @@ where /// * a [`Clipboard`], if available /// /// 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( &mut self, _event: Event, diff --git a/native/src/overlay/element.rs b/native/src/overlay/element.rs index 3f346695..0f44a781 100644 --- a/native/src/overlay/element.rs +++ b/native/src/overlay/element.rs @@ -5,8 +5,6 @@ use crate::layout; use crate::{Clipboard, Hasher, Layout, Point, Size, Vector}; /// A generic [`Overlay`]. -/// -/// [`Overlay`]: trait.Overlay.html #[allow(missing_debug_implementations)] pub struct Element<'a, Message, Renderer> { position: Point, @@ -18,9 +16,6 @@ where Renderer: crate::Renderer, { /// Creates a new [`Element`] containing the given [`Overlay`]. - /// - /// [`Element`]: struct.Element.html - /// [`Overlay`]: trait.Overlay.html pub fn new( position: Point, overlay: Box<dyn Overlay<Message, Renderer> + 'a>, @@ -29,16 +24,12 @@ where } /// Translates the [`Element`]. - /// - /// [`Element`]: struct.Element.html pub fn translate(mut self, translation: Vector) -> Self { self.position = self.position + translation; self } /// 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> where Message: 'a, @@ -52,15 +43,11 @@ where } /// Computes the layout of the [`Element`] in the given bounds. - /// - /// [`Element`]: struct.Element.html pub fn layout(&self, renderer: &Renderer, bounds: Size) -> layout::Node { self.overlay.layout(renderer, bounds, self.position) } /// Processes a runtime [`Event`]. - /// - /// [`Event`]: enum.Event.html pub fn on_event( &mut self, event: Event, @@ -81,9 +68,6 @@ where } /// Draws the [`Element`] and its children using the given [`Layout`]. - /// - /// [`Element`]: struct.Element.html - /// [`Layout`]: layout/struct.Layout.html pub fn draw( &self, renderer: &mut Renderer, @@ -96,8 +80,6 @@ where } /// Computes the _layout_ hash of the [`Element`]. - /// - /// [`Element`]: struct.Element.html pub fn hash_layout(&self, state: &mut Hasher) { self.overlay.hash_layout(state, self.position); } diff --git a/native/src/overlay/menu.rs b/native/src/overlay/menu.rs index d99b5940..abac849f 100644 --- a/native/src/overlay/menu.rs +++ b/native/src/overlay/menu.rs @@ -32,9 +32,6 @@ where { /// Creates a new [`Menu`] with the given [`State`], a list of options, and /// the message to produced when an option is selected. - /// - /// [`Menu`]: struct.Menu.html - /// [`State`]: struct.State.html pub fn new( state: &'a mut State, options: &'a [T], @@ -55,40 +52,30 @@ where } /// Sets the width of the [`Menu`]. - /// - /// [`Menu`]: struct.Menu.html pub fn width(mut self, width: u16) -> Self { self.width = width; self } /// Sets the padding of the [`Menu`]. - /// - /// [`Menu`]: struct.Menu.html pub fn padding(mut self, padding: u16) -> Self { self.padding = padding; self } /// Sets the text size of the [`Menu`]. - /// - /// [`Menu`]: struct.Menu.html pub fn text_size(mut self, text_size: u16) -> Self { self.text_size = Some(text_size); self } /// Sets the font of the [`Menu`]. - /// - /// [`Menu`]: struct.Menu.html pub fn font(mut self, font: Renderer::Font) -> Self { self.font = font; self } /// Sets the style of the [`Menu`]. - /// - /// [`Menu`]: struct.Menu.html pub fn style( mut self, 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 /// of the target or under it, depending on the screen position and the /// dimensions of the [`Menu`]. - /// - /// [`Menu`]: struct.Menu.html pub fn overlay<Message: 'a>( self, position: Point, @@ -118,8 +103,6 @@ where } /// The local state of a [`Menu`]. -/// -/// [`Menu`]: struct.Menu.html #[derive(Debug, Clone, Default)] pub struct State { scrollable: scrollable::State, @@ -127,9 +110,6 @@ pub struct State { impl State { /// Creates a new [`State`] for a [`Menu`]. - /// - /// [`State`]: struct.State.html - /// [`Menu`]: struct.Menu.html pub fn new() -> Self { Self::default() } @@ -402,21 +382,16 @@ where /// Your [renderer] will need to implement this trait before being /// able to use a [`Menu`] in your user interface. /// -/// [`Menu`]: struct.Menu.html -/// [renderer]: ../../renderer/index.html +/// [renderer]: crate::renderer pub trait Renderer: scrollable::Renderer + container::Renderer + text::Renderer { /// The [`Menu`] style supported by this renderer. - /// - /// [`Menu`]: struct.Menu.html type Style: Default + Clone; /// Decorates a the list of options of a [`Menu`]. /// /// This method can be used to draw a background for the [`Menu`]. - /// - /// [`Menu`]: struct.Menu.html fn decorate( &mut self, bounds: Rectangle, @@ -426,8 +401,6 @@ pub trait Renderer: ) -> Self::Output; /// Draws the list of options of a [`Menu`]. - /// - /// [`Menu`]: struct.Menu.html fn draw<T: ToString>( &mut self, bounds: Rectangle, diff --git a/native/src/program.rs b/native/src/program.rs index 14afcd84..9ee72703 100644 --- a/native/src/program.rs +++ b/native/src/program.rs @@ -8,13 +8,9 @@ pub use state::State; /// The core of a user interface application following The Elm Architecture. pub trait Program: Sized { /// The graphics backend to use to draw the [`Program`]. - /// - /// [`Program`]: trait.Program.html type Renderer: Renderer; /// The type of __messages__ your [`Program`] will produce. - /// - /// [`Program`]: trait.Program.html type Message: std::fmt::Debug + Send; /// 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 /// background by shells. - /// - /// [`Program`]: trait.Application.html - /// [`Command`]: struct.Command.html fn update(&mut self, message: Self::Message) -> Command<Self::Message>; /// Returns the widgets to display in the [`Program`]. /// /// These widgets can produce __messages__ based on user interaction. - /// - /// [`Program`]: trait.Program.html fn view(&mut self) -> Element<'_, Self::Message, Self::Renderer>; } diff --git a/native/src/program/state.rs b/native/src/program/state.rs index 76283e30..e630890a 100644 --- a/native/src/program/state.rs +++ b/native/src/program/state.rs @@ -5,8 +5,6 @@ use crate::{ /// The execution state of a [`Program`]. It leverages caching, event /// processing, and rendering primitive storage. -/// -/// [`Program`]: trait.Program.html #[allow(missing_debug_implementations)] pub struct State<P> where @@ -25,9 +23,6 @@ where { /// Creates a new [`State`] with the provided [`Program`], initializing its /// primitive with the given logical bounds and renderer. - /// - /// [`State`]: struct.State.html - /// [`Program`]: trait.Program.html pub fn new( mut program: P, bounds: Size, @@ -59,39 +54,30 @@ where } /// Returns a reference to the [`Program`] of the [`State`]. - /// - /// [`Program`]: trait.Program.html - /// [`State`]: struct.State.html pub fn program(&self) -> &P { &self.program } /// Returns a reference to the current rendering primitive of the [`State`]. - /// - /// [`State`]: struct.State.html pub fn primitive(&self) -> &<P::Renderer as Renderer>::Output { &self.primitive } /// Queues an event in the [`State`] for processing during an [`update`]. /// - /// [`State`]: struct.State.html - /// [`update`]: #method.update + /// [`update`]: Self::update pub fn queue_event(&mut self, event: Event) { self.queued_events.push(event); } /// Queues a message in the [`State`] for processing during an [`update`]. /// - /// [`State`]: struct.State.html - /// [`update`]: #method.update + /// [`update`]: Self::update pub fn queue_message(&mut self, message: P::Message) { self.queued_messages.push(message); } /// Returns whether the event queue of the [`State`] is empty or not. - /// - /// [`State`]: struct.State.html pub fn is_queue_empty(&self) -> bool { self.queued_events.is_empty() && self.queued_messages.is_empty() } @@ -101,8 +87,6 @@ where /// /// Returns the [`Command`] obtained from [`Program`] after updating it, /// only if an update was necessary. - /// - /// [`Program`]: trait.Program.html pub fn update( &mut self, bounds: Size, diff --git a/native/src/renderer.rs b/native/src/renderer.rs index d986141f..39a6cff1 100644 --- a/native/src/renderer.rs +++ b/native/src/renderer.rs @@ -13,12 +13,12 @@ //! In the end, a __renderer__ satisfying all the constraints is //! needed to build a [`UserInterface`]. //! -//! [`Widget`]: ../widget/trait.Widget.html -//! [`UserInterface`]: ../struct.UserInterface.html -//! [`Text`]: ../widget/text/struct.Text.html -//! [`text::Renderer`]: ../widget/text/trait.Renderer.html -//! [`Checkbox`]: ../widget/checkbox/struct.Checkbox.html -//! [`checkbox::Renderer`]: ../widget/checkbox/trait.Renderer.html +//! [`Widget`]: crate::Widget +//! [`UserInterface`]: crate::UserInterface +//! [`Text`]: crate::widget::Text +//! [`text::Renderer`]: crate::widget::text::Renderer +//! [`Checkbox`]: crate::widget::Checkbox +//! [`checkbox::Renderer`]: crate::widget::checkbox::Renderer #[cfg(debug_assertions)] mod null; @@ -34,15 +34,11 @@ pub trait Renderer: Sized { /// /// If you are implementing a graphical renderer, your output will most /// likely be a tree of visual primitives. - /// - /// [`Renderer`]: trait.Renderer.html type Output; /// The default styling attributes of the [`Renderer`]. /// /// This type can be leveraged to implement style inheritance. - /// - /// [`Renderer`]: trait.Renderer.html type Defaults: Default; /// Lays out the elements of a user interface. diff --git a/native/src/renderer/null.rs b/native/src/renderer/null.rs index a3c3cf33..91ee9a28 100644 --- a/native/src/renderer/null.rs +++ b/native/src/renderer/null.rs @@ -13,8 +13,6 @@ pub struct Null; impl Null { /// Creates a new [`Null`] renderer. - /// - /// [`Null`]: struct.Null.html pub fn new() -> Null { Null } diff --git a/native/src/runtime.rs b/native/src/runtime.rs index bd814a0b..5b0a6925 100644 --- a/native/src/runtime.rs +++ b/native/src/runtime.rs @@ -7,8 +7,8 @@ use crate::Hasher; /// It can be used by shells to easily spawn a [`Command`] or track a /// [`Subscription`]. /// -/// [`Command`]: ../struct.Command.html -/// [`Subscription`]: ../struct.Subscription.html +/// [`Command`]: crate::Command +/// [`Subscription`]: crate::Subscription pub type Runtime<Executor, Receiver, Message> = iced_futures::Runtime< Hasher, (Event, event::Status), diff --git a/native/src/subscription.rs b/native/src/subscription.rs index 3cc04188..ff954382 100644 --- a/native/src/subscription.rs +++ b/native/src/subscription.rs @@ -14,21 +14,16 @@ use iced_futures::futures::stream::BoxStream; /// For instance, you can use a [`Subscription`] to listen to a WebSocket /// connection, keyboard presses, mouse events, time ticks, etc. /// -/// [`Command`]: ../struct.Command.html -/// [`Subscription`]: struct.Subscription.html +/// [`Command`]: crate::Command pub type Subscription<T> = iced_futures::Subscription<Hasher, (Event, event::Status), T>; /// A stream of runtime events. /// /// It is the input of a [`Subscription`] in the native runtime. -/// -/// [`Subscription`]: type.Subscription.html pub type EventStream = BoxStream<'static, (Event, event::Status)>; /// A native [`Subscription`] tracker. -/// -/// [`Subscription`]: type.Subscription.html pub type Tracker = 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 /// not captured by any widget. -/// -/// [`Subscription`]: type.Subscription.html -/// [`Event`]: ../enum.Event.html pub fn events() -> Subscription<Event> { Subscription::from_recipe(Events { f: |event, status| match status { @@ -62,9 +54,6 @@ pub fn events() -> Subscription<Event> { /// /// - Returns `None`, the [`Event`] will be discarded. /// - Returns `Some` message, the `Message` will be produced. -/// -/// [`Subscription`]: type.Subscription.html -/// [`Event`]: ../enum.Event.html pub fn events_with<Message>( f: fn(Event, event::Status) -> Option<Message>, ) -> Subscription<Message> diff --git a/native/src/user_interface.rs b/native/src/user_interface.rs index 31bb6b99..f859ff6d 100644 --- a/native/src/user_interface.rs +++ b/native/src/user_interface.rs @@ -12,14 +12,11 @@ use std::hash::Hasher; /// 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. /// -/// [`Layout`]: struct.Layout.html -/// /// # Example /// The [`integration` example] uses a [`UserInterface`] to integrate Iced in /// an existing graphical application. /// /// [`integration` example]: https://github.com/hecrj/iced/tree/0.1/examples/integration -/// [`UserInterface`]: struct.UserInterface.html #[allow(missing_debug_implementations)] pub struct UserInterface<'a, Message, Renderer> { root: Element<'a, Message, Renderer>, @@ -37,10 +34,6 @@ where /// It is able to avoid expensive computations when using a [`Cache`] /// obtained from a previous instance of a [`UserInterface`]. /// - /// [`Element`]: struct.Element.html - /// [`Cache`]: struct.Cache.html - /// [`UserInterface`]: struct.UserInterface.html - /// /// # Example /// Imagine we want to build a [`UserInterface`] for /// [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 /// interactions. You should feed these to your __update logic__. /// - /// [`UserInterface`]: struct.UserInterface.html - /// [`Event`]: enum.Event.html - /// /// # Example /// Let's allow our [counter](index.html#usage) to change state by /// completing [the previous example](#example): @@ -268,12 +258,11 @@ where /// Draws the [`UserInterface`] with the provided [`Renderer`]. /// - /// It returns the current state of the [`MouseCursor`]. You should update - /// the icon of the mouse cursor accordingly in your system. + /// It returns the some [`Renderer::Output`]. You should update the icon of + /// the mouse cursor accordingly in your system. /// - /// [`UserInterface`]: struct.UserInterface.html - /// [`Renderer`]: trait.Renderer.html - /// [`MouseCursor`]: enum.MouseCursor.html + /// [`Renderer`]: crate::Renderer + /// [`Renderer::Output`]: crate::Renderer::Output /// /// # Example /// We can finally draw our [counter](index.html#usage) by @@ -404,8 +393,6 @@ where /// Relayouts and returns a new [`UserInterface`] using the provided /// bounds. - /// - /// [`UserInterface`]: struct.UserInterface.html pub fn relayout(self, bounds: Size, renderer: &mut Renderer) -> Self { Self::build( self.root, @@ -421,9 +408,6 @@ where /// Extract the [`Cache`] of the [`UserInterface`], consuming it in the /// process. - /// - /// [`Cache`]: struct.Cache.html - /// [`UserInterface`]: struct.UserInterface.html pub fn into_cache(self) -> Cache { Cache { base: self.base, @@ -464,8 +448,6 @@ struct Layer { } /// Reusable data of a specific [`UserInterface`]. -/// -/// [`UserInterface`]: struct.UserInterface.html #[derive(Debug, Clone)] pub struct Cache { base: Layer, @@ -478,9 +460,6 @@ impl Cache { /// /// You should use this to initialize a [`Cache`] before building your first /// [`UserInterface`]. - /// - /// [`Cache`]: struct.Cache.html - /// [`UserInterface`]: struct.UserInterface.html pub fn new() -> Cache { Cache { base: Layer { diff --git a/native/src/widget.rs b/native/src/widget.rs index d3ffe9c2..08dfa298 100644 --- a/native/src/widget.rs +++ b/native/src/widget.rs @@ -18,8 +18,7 @@ //! use iced_native::{button, Button, Widget}; //! ``` //! -//! [`Widget`]: trait.Widget.html -//! [renderer]: ../renderer/index.html +//! [renderer]: crate::renderer pub mod button; pub mod checkbox; 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 /// trait. /// -/// [`Widget`]: trait.Widget.html -/// [`Element`]: ../struct.Element.html -/// /// # Examples /// The repository has some [examples] showcasing how to implement a custom /// widget: @@ -108,13 +104,9 @@ where Renderer: crate::Renderer, { /// Returns the width of the [`Widget`]. - /// - /// [`Widget`]: trait.Widget.html fn width(&self) -> Length; /// Returns the height of the [`Widget`]. - /// - /// [`Widget`]: trait.Widget.html fn height(&self) -> Length; /// Returns the [`Node`] of the [`Widget`]. @@ -122,9 +114,7 @@ where /// This [`Node`] is used by the runtime to compute the [`Layout`] of the /// user interface. /// - /// [`Node`]: ../layout/struct.Node.html - /// [`Widget`]: trait.Widget.html - /// [`Layout`]: ../layout/struct.Layout.html + /// [`Node`]: layout::Node fn layout( &self, renderer: &Renderer, @@ -132,8 +122,6 @@ where ) -> layout::Node; /// Draws the [`Widget`] using the associated `Renderer`. - /// - /// [`Widget`]: trait.Widget.html fn draw( &self, renderer: &mut Renderer, @@ -153,9 +141,7 @@ where /// For example, the [`Text`] widget does not hash its color property, as /// its value cannot affect the overall [`Layout`] of the user interface. /// - /// [`Widget`]: trait.Widget.html - /// [`Layout`]: ../layout/struct.Layout.html - /// [`Text`]: text/struct.Text.html + /// [`Text`]: crate::widget::Text fn hash_layout(&self, state: &mut Hasher); /// Processes a runtime [`Event`]. @@ -170,11 +156,6 @@ where /// * a [`Clipboard`], if available /// /// 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( &mut self, _event: Event, @@ -187,9 +168,7 @@ where event::Status::Ignored } - /// Returns the overlay of the [`Element`], if there is any. - /// - /// [`Element`]: struct.Element.html + /// Returns the overlay of the [`Widget`], if there is any. fn overlay( &mut self, _layout: Layout<'_>, diff --git a/native/src/widget/button.rs b/native/src/widget/button.rs index 466f6ac5..dca20e13 100644 --- a/native/src/widget/button.rs +++ b/native/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`]: struct.Button.html -//! [`State`]: struct.State.html use crate::event::{self, Event}; use crate::layout; use crate::mouse; @@ -49,9 +46,6 @@ where { /// Creates a new [`Button`] with some local [`State`] and the given /// content. - /// - /// [`Button`]: struct.Button.html - /// [`State`]: struct.State.html pub fn new<E>(state: &'a mut State, content: E) -> Self where E: Into<Element<'a, Message, Renderer>>, @@ -70,56 +64,42 @@ where } /// Sets the width of the [`Button`]. - /// - /// [`Button`]: struct.Button.html pub fn width(mut self, width: Length) -> Self { self.width = width; self } /// Sets the height of the [`Button`]. - /// - /// [`Button`]: struct.Button.html pub fn height(mut self, height: Length) -> Self { self.height = height; self } /// Sets the minimum width of the [`Button`]. - /// - /// [`Button`]: struct.Button.html pub fn min_width(mut self, min_width: u32) -> Self { self.min_width = min_width; self } /// Sets the minimum height of the [`Button`]. - /// - /// [`Button`]: struct.Button.html pub fn min_height(mut self, min_height: u32) -> Self { self.min_height = min_height; self } /// Sets the padding of the [`Button`]. - /// - /// [`Button`]: struct.Button.html pub fn padding(mut self, padding: u16) -> Self { self.padding = padding; self } /// 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 { self.on_press = Some(msg); self } /// Sets the style of the [`Button`]. - /// - /// [`Button`]: struct.Button.html pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { self.style = style.into(); self @@ -127,8 +107,6 @@ where } /// The local state of a [`Button`]. -/// -/// [`Button`]: struct.Button.html #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] pub struct State { is_pressed: bool, @@ -136,8 +114,6 @@ pub struct State { impl State { /// Creates a new [`State`]. - /// - /// [`State`]: struct.State.html pub fn new() -> State { State::default() } @@ -254,20 +230,15 @@ where /// Your [renderer] will need to implement this trait before being /// able to use a [`Button`] in your user interface. /// -/// [`Button`]: struct.Button.html -/// [renderer]: ../../renderer/index.html +/// [renderer]: crate::renderer pub trait Renderer: crate::Renderer + Sized { /// The default padding of a [`Button`]. - /// - /// [`Button`]: struct.Button.html const DEFAULT_PADDING: u16; /// The style supported by this renderer. type Style: Default; /// Draws a [`Button`]. - /// - /// [`Button`]: struct.Button.html fn draw<Message>( &mut self, defaults: &Self::Defaults, diff --git a/native/src/widget/checkbox.rs b/native/src/widget/checkbox.rs index 42e52aef..81420458 100644 --- a/native/src/widget/checkbox.rs +++ b/native/src/widget/checkbox.rs @@ -52,8 +52,6 @@ impl<Message, Renderer: self::Renderer + text::Renderer> /// * a function that will be called when the [`Checkbox`] is toggled. It /// will receive the new state of the [`Checkbox`] and must produce a /// `Message`. - /// - /// [`Checkbox`]: struct.Checkbox.html pub fn new<F>(is_checked: bool, label: impl Into<String>, f: F) -> Self where F: 'static + Fn(bool) -> Message, @@ -72,32 +70,24 @@ impl<Message, Renderer: self::Renderer + text::Renderer> } /// Sets the size of the [`Checkbox`]. - /// - /// [`Checkbox`]: struct.Checkbox.html pub fn size(mut self, size: u16) -> Self { self.size = size; self } /// Sets the width of the [`Checkbox`]. - /// - /// [`Checkbox`]: struct.Checkbox.html pub fn width(mut self, width: Length) -> Self { self.width = width; self } /// Sets the spacing between the [`Checkbox`] and the text. - /// - /// [`Checkbox`]: struct.Checkbox.html pub fn spacing(mut self, spacing: u16) -> Self { self.spacing = spacing; self } /// Sets the text size of the [`Checkbox`]. - /// - /// [`Checkbox`]: struct.Checkbox.html pub fn text_size(mut self, text_size: u16) -> Self { self.text_size = Some(text_size); self @@ -105,16 +95,13 @@ impl<Message, Renderer: self::Renderer + text::Renderer> /// Sets the [`Font`] of the text of the [`Checkbox`]. /// - /// [`Checkbox`]: struct.Checkbox.html - /// [`Font`]: ../../struct.Font.html + /// [`Font`]: crate::widget::text::Renderer::Font pub fn font(mut self, font: Renderer::Font) -> Self { self.font = font; self } /// Sets the style of the [`Checkbox`]. - /// - /// [`Checkbox`]: struct.Checkbox.html pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { self.style = style.into(); self @@ -234,20 +221,15 @@ where /// Your [renderer] will need to implement this trait before being /// able to use a [`Checkbox`] in your user interface. /// -/// [`Checkbox`]: struct.Checkbox.html -/// [renderer]: ../../renderer/index.html +/// [renderer]: crate::Renderer pub trait Renderer: crate::Renderer { /// The style supported by this renderer. type Style: Default; /// The default size of a [`Checkbox`]. - /// - /// [`Checkbox`]: struct.Checkbox.html const DEFAULT_SIZE: u16; /// The default spacing of a [`Checkbox`]. - /// - /// [`Checkbox`]: struct.Checkbox.html const DEFAULT_SPACING: u16; /// Draws a [`Checkbox`]. @@ -257,8 +239,6 @@ pub trait Renderer: crate::Renderer { /// * whether the [`Checkbox`] is selected or not /// * whether the mouse is over the [`Checkbox`] or not /// * the drawn label of the [`Checkbox`] - /// - /// [`Checkbox`]: struct.Checkbox.html fn draw( &mut self, bounds: Rectangle, diff --git a/native/src/widget/column.rs b/native/src/widget/column.rs index 42a9e734..e0e88d31 100644 --- a/native/src/widget/column.rs +++ b/native/src/widget/column.rs @@ -25,15 +25,11 @@ pub struct Column<'a, Message, Renderer> { impl<'a, Message, Renderer> Column<'a, Message, Renderer> { /// Creates an empty [`Column`]. - /// - /// [`Column`]: struct.Column.html pub fn new() -> Self { Self::with_children(Vec::new()) } /// Creates a [`Column`] with the given elements. - /// - /// [`Column`]: struct.Column.html pub fn with_children( children: Vec<Element<'a, Message, Renderer>>, ) -> Self { @@ -60,56 +56,42 @@ impl<'a, Message, Renderer> Column<'a, Message, Renderer> { } /// Sets the padding of the [`Column`]. - /// - /// [`Column`]: struct.Column.html pub fn padding(mut self, units: u16) -> Self { self.padding = units; self } /// Sets the width of the [`Column`]. - /// - /// [`Column`]: struct.Column.html pub fn width(mut self, width: Length) -> Self { self.width = width; self } /// Sets the height of the [`Column`]. - /// - /// [`Column`]: struct.Column.html pub fn height(mut self, height: Length) -> Self { self.height = height; self } /// Sets the maximum width of the [`Column`]. - /// - /// [`Column`]: struct.Column.html pub fn max_width(mut self, max_width: u32) -> Self { self.max_width = max_width; self } /// Sets the maximum height of the [`Column`] in pixels. - /// - /// [`Column`]: struct.Column.html pub fn max_height(mut self, max_height: u32) -> Self { self.max_height = max_height; self } /// Sets the horizontal alignment of the contents of the [`Column`] . - /// - /// [`Column`]: struct.Column.html pub fn align_items(mut self, align: Align) -> Self { self.align_items = align; self } /// Adds an element to the [`Column`]. - /// - /// [`Column`]: struct.Column.html pub fn push<E>(mut self, child: E) -> Self where E: Into<Element<'a, Message, Renderer>>, @@ -230,8 +212,7 @@ where /// Your [renderer] will need to implement this trait before being /// able to use a [`Column`] in your user interface. /// -/// [`Column`]: struct.Column.html -/// [renderer]: ../../renderer/index.html +/// [renderer]: crate::renderer pub trait Renderer: crate::Renderer + Sized { /// Draws a [`Column`]. /// @@ -239,9 +220,6 @@ pub trait Renderer: crate::Renderer + Sized { /// - the children of the [`Column`] /// - the [`Layout`] of the [`Column`] and its children /// - the cursor position - /// - /// [`Column`]: struct.Column.html - /// [`Layout`]: ../layout/struct.Layout.html fn draw<Message>( &mut self, defaults: &Self::Defaults, diff --git a/native/src/widget/container.rs b/native/src/widget/container.rs index 419060db..65764148 100644 --- a/native/src/widget/container.rs +++ b/native/src/widget/container.rs @@ -31,8 +31,6 @@ where Renderer: self::Renderer, { /// Creates an empty [`Container`]. - /// - /// [`Container`]: struct.Container.html pub fn new<T>(content: T) -> Self where T: Into<Element<'a, Message, Renderer>>, @@ -51,80 +49,60 @@ where } /// Sets the padding of the [`Container`]. - /// - /// [`Container`]: struct.Column.html pub fn padding(mut self, units: u16) -> Self { self.padding = units; self } /// Sets the width of the [`Container`]. - /// - /// [`Container`]: struct.Container.html pub fn width(mut self, width: Length) -> Self { self.width = width; self } /// Sets the height of the [`Container`]. - /// - /// [`Container`]: struct.Container.html pub fn height(mut self, height: Length) -> Self { self.height = height; self } /// Sets the maximum width of the [`Container`]. - /// - /// [`Container`]: struct.Container.html pub fn max_width(mut self, max_width: u32) -> Self { self.max_width = max_width; self } /// Sets the maximum height of the [`Container`] in pixels. - /// - /// [`Container`]: struct.Container.html pub fn max_height(mut self, max_height: u32) -> Self { self.max_height = max_height; self } /// Sets the content alignment for the horizontal axis of the [`Container`]. - /// - /// [`Container`]: struct.Container.html pub fn align_x(mut self, alignment: Align) -> Self { self.horizontal_alignment = alignment; self } /// Sets the content alignment for the vertical axis of the [`Container`]. - /// - /// [`Container`]: struct.Container.html pub fn align_y(mut self, alignment: Align) -> Self { self.vertical_alignment = alignment; self } /// Centers the contents in the horizontal axis of the [`Container`]. - /// - /// [`Container`]: struct.Container.html pub fn center_x(mut self) -> Self { self.horizontal_alignment = Align::Center; self } /// Centers the contents in the vertical axis of the [`Container`]. - /// - /// [`Container`]: struct.Container.html pub fn center_y(mut self) -> Self { self.vertical_alignment = Align::Center; self } /// Sets the style of the [`Container`]. - /// - /// [`Container`]: struct.Container.html pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { self.style = style.into(); self @@ -232,15 +210,12 @@ where /// Your [renderer] will need to implement this trait before being /// able to use a [`Container`] in your user interface. /// -/// [`Container`]: struct.Container.html -/// [renderer]: ../../renderer/index.html +/// [renderer]: crate::renderer pub trait Renderer: crate::Renderer { /// The style supported by this renderer. type Style: Default; /// Draws a [`Container`]. - /// - /// [`Container`]: struct.Container.html fn draw<Message>( &mut self, defaults: &Self::Defaults, diff --git a/native/src/widget/image.rs b/native/src/widget/image.rs index 9586da0f..51d7ba26 100644 --- a/native/src/widget/image.rs +++ b/native/src/widget/image.rs @@ -28,8 +28,6 @@ pub struct Image { impl Image { /// Creates a new [`Image`] with the given path. - /// - /// [`Image`]: struct.Image.html pub fn new<T: Into<Handle>>(handle: T) -> Self { Image { handle: handle.into(), @@ -39,16 +37,12 @@ impl Image { } /// Sets the width of the [`Image`] boundaries. - /// - /// [`Image`]: struct.Image.html pub fn width(mut self, width: Length) -> Self { self.width = width; self } /// Sets the height of the [`Image`] boundaries. - /// - /// [`Image`]: struct.Image.html pub fn height(mut self, height: Length) -> Self { self.height = height; self @@ -114,8 +108,6 @@ where } /// An [`Image`] handle. -/// -/// [`Image`]: struct.Image.html #[derive(Debug, Clone)] pub struct Handle { id: u64, @@ -126,8 +118,6 @@ impl Handle { /// 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. - /// - /// [`Handle`]: struct.Handle.html pub fn from_path<T: Into<PathBuf>>(path: T) -> Handle { Self::from_data(Data::Path(path.into())) } @@ -137,8 +127,6 @@ impl Handle { /// pixels. /// /// 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 { Self::from_data(Data::Pixels { width, @@ -153,8 +141,6 @@ impl Handle { /// /// This is useful if you already have your image loaded in-memory, maybe /// because you downloaded or generated it procedurally. - /// - /// [`Handle`]: struct.Handle.html pub fn from_memory(bytes: Vec<u8>) -> Handle { Self::from_data(Data::Bytes(bytes)) } @@ -170,15 +156,11 @@ impl Handle { } /// Returns the unique identifier of the [`Handle`]. - /// - /// [`Handle`]: struct.Handle.html pub fn id(&self) -> u64 { self.id } /// Returns a reference to the image [`Data`]. - /// - /// [`Data`]: enum.Data.html pub fn data(&self) -> &Data { &self.data } @@ -200,8 +182,6 @@ impl Hash for Handle { } /// The data of an [`Image`]. -/// -/// [`Image`]: struct.Image.html #[derive(Clone, Hash)] pub enum 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 /// an [`Image`] in your user interface. /// -/// [`Image`]: struct.Image.html -/// [renderer]: ../../renderer/index.html +/// [renderer]: crate::renderer pub trait Renderer: crate::Renderer { /// Returns the dimensions of an [`Image`] located on the given path. - /// - /// [`Image`]: struct.Image.html fn dimensions(&self, handle: &Handle) -> (u32, u32); /// Draws an [`Image`]. - /// - /// [`Image`]: struct.Image.html fn draw(&mut self, handle: Handle, layout: Layout<'_>) -> Self::Output; } diff --git a/native/src/widget/pane_grid.rs b/native/src/widget/pane_grid.rs index acb43276..ff19cbc2 100644 --- a/native/src/widget/pane_grid.rs +++ b/native/src/widget/pane_grid.rs @@ -6,8 +6,7 @@ //! The [`pane_grid` example] showcases how to use a [`PaneGrid`] with resizing, //! drag and drop, and hotkey support. //! -//! [`pane_grid` example]: https://github.com/hecrj/iced/tree/0.1/examples/pane_grid -//! [`PaneGrid`]: struct.PaneGrid.html +//! [`pane_grid` example]: https://github.com/hecrj/iced/tree/0.2/examples/pane_grid mod axis; mod configuration; mod content; @@ -89,9 +88,6 @@ use crate::{ /// .on_drag(Message::PaneDragged) /// .on_resize(10, Message::PaneResized); /// ``` -/// -/// [`PaneGrid`]: struct.PaneGrid.html -/// [`State`]: struct.State.html #[allow(missing_debug_implementations)] pub struct PaneGrid<'a, Message, Renderer: self::Renderer> { state: &'a mut state::Internal, @@ -112,10 +108,6 @@ where /// /// The view function will be called to display each [`Pane`] present in the /// [`State`]. - /// - /// [`PaneGrid`]: struct.PaneGrid.html - /// [`State`]: struct.State.html - /// [`Pane`]: struct.Pane.html pub fn new<T>( state: &'a mut State<T>, view: impl Fn(Pane, &'a mut T) -> Content<'a, Message, Renderer>, @@ -141,24 +133,18 @@ where } /// Sets the width of the [`PaneGrid`]. - /// - /// [`PaneGrid`]: struct.PaneGrid.html pub fn width(mut self, width: Length) -> Self { self.width = width; self } /// Sets the height of the [`PaneGrid`]. - /// - /// [`PaneGrid`]: struct.PaneGrid.html pub fn height(mut self, height: Length) -> Self { self.height = height; self } /// Sets the spacing _between_ the panes of the [`PaneGrid`]. - /// - /// [`PaneGrid`]: struct.PaneGrid.html pub fn spacing(mut self, units: u16) -> Self { self.spacing = units; self @@ -166,9 +152,6 @@ where /// Sets the message that will be produced when a [`Pane`] of the /// [`PaneGrid`] is clicked. - /// - /// [`Pane`]: struct.Pane.html - /// [`PaneGrid`]: struct.PaneGrid.html pub fn on_click<F>(mut self, f: F) -> Self where F: 'a + Fn(Pane) -> Message, @@ -179,8 +162,6 @@ where /// Enables the drag and drop interactions of the [`PaneGrid`], which will /// use the provided function to produce messages. - /// - /// [`PaneGrid`]: struct.PaneGrid.html pub fn on_drag<F>(mut self, f: F) -> Self where F: 'a + Fn(DragEvent) -> Message, @@ -198,8 +179,6 @@ where /// The grabbable area of a split will have a length of `spacing + leeway`, /// properly centered. In other words, a length of /// `(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 where F: 'a + Fn(ResizeEvent) -> Message, @@ -287,63 +266,41 @@ where } /// An event produced during a drag and drop interaction of a [`PaneGrid`]. -/// -/// [`PaneGrid`]: struct.PaneGrid.html #[derive(Debug, Clone, Copy)] pub enum DragEvent { /// A [`Pane`] was picked for dragging. - /// - /// [`Pane`]: struct.Pane.html Picked { /// The picked [`Pane`]. - /// - /// [`Pane`]: struct.Pane.html pane: Pane, }, /// A [`Pane`] was dropped on top of another [`Pane`]. - /// - /// [`Pane`]: struct.Pane.html Dropped { /// The picked [`Pane`]. - /// - /// [`Pane`]: struct.Pane.html pane: Pane, /// The [`Pane`] where the picked one was dropped on. - /// - /// [`Pane`]: struct.Pane.html target: Pane, }, /// A [`Pane`] was picked and then dropped outside of other [`Pane`] /// boundaries. - /// - /// [`Pane`]: struct.Pane.html Canceled { /// The picked [`Pane`]. - /// - /// [`Pane`]: struct.Pane.html pane: Pane, }, } /// An event produced during a resize interaction of a [`PaneGrid`]. -/// -/// [`PaneGrid`]: struct.PaneGrid.html #[derive(Debug, Clone, Copy)] pub struct ResizeEvent { /// The [`Split`] that is being dragged for resizing. - /// - /// [`Split`]: struct.Split.html pub split: Split, /// The new ratio of the [`Split`]. /// /// The ratio is a value in [0, 1], representing the exact position of a /// [`Split`] between two panes. - /// - /// [`Split`]: struct.Split.html pub ratio: f32, } @@ -585,8 +542,7 @@ where /// Your [renderer] will need to implement this trait before being /// able to use a [`PaneGrid`] in your user interface. /// -/// [`PaneGrid`]: struct.PaneGrid.html -/// [renderer]: ../../renderer/index.html +/// [renderer]: crate::renderer pub trait Renderer: crate::Renderer + container::Renderer + text::Renderer + Sized { @@ -598,10 +554,6 @@ pub trait Renderer: /// - the [`Axis`] that is currently being resized /// - the [`Layout`] of the [`PaneGrid`] and its elements /// - the cursor position - /// - /// [`PaneGrid`]: struct.PaneGrid.html - /// [`Pane`]: struct.Pane.html - /// [`Layout`]: ../layout/struct.Layout.html fn draw<Message>( &mut self, defaults: &Self::Defaults, @@ -619,9 +571,6 @@ pub trait Renderer: /// - the [`Content`] of the [`Pane`] /// - the [`Layout`] of the [`Pane`] and its elements /// - the cursor position - /// - /// [`Pane`]: struct.Pane.html - /// [`Layout`]: ../layout/struct.Layout.html fn draw_pane<Message>( &mut self, defaults: &Self::Defaults, @@ -640,9 +589,6 @@ pub trait Renderer: /// - the title of the [`TitleBar`] with its size, font, and bounds /// - the controls of the [`TitleBar`] with their [`Layout`+, if any /// - the cursor position - /// - /// [`TitleBar`]: struct.TitleBar.html - /// [`Layout`]: ../layout/struct.Layout.html fn draw_title_bar<Message>( &mut self, defaults: &Self::Defaults, diff --git a/native/src/widget/pane_grid/configuration.rs b/native/src/widget/pane_grid/configuration.rs index 1fed98b7..4c43826e 100644 --- a/native/src/widget/pane_grid/configuration.rs +++ b/native/src/widget/pane_grid/configuration.rs @@ -2,7 +2,7 @@ use crate::pane_grid::Axis; /// The arrangement of a [`PaneGrid`]. /// -/// [`PaneGrid`]: struct.PaneGrid.html +/// [`PaneGrid`]: crate::pane_grid::PaneGrid #[derive(Debug, Clone)] pub enum Configuration<T> { /// A split of the available space. @@ -13,18 +13,14 @@ pub enum Configuration<T> { /// The ratio of the split in [0.0, 1.0]. ratio: f32, - /// The left/top [`Content`] of the split. - /// - /// [`Configuration`]: enum.Node.html + /// The left/top [`Configuration`] of the split. a: Box<Configuration<T>>, - /// The right/bottom [`Content`] of the split. - /// - /// [`Configuration`]: enum.Node.html + /// The right/bottom [`Configuration`] of the split. b: Box<Configuration<T>>, }, /// A [`Pane`]. /// - /// [`Pane`]: struct.Pane.html + /// [`Pane`]: crate::pane_grid::Pane Pane(T), } diff --git a/native/src/widget/pane_grid/content.rs b/native/src/widget/pane_grid/content.rs index 2dac7060..c9981903 100644 --- a/native/src/widget/pane_grid/content.rs +++ b/native/src/widget/pane_grid/content.rs @@ -7,7 +7,7 @@ use crate::{Clipboard, Element, Hasher, Layout, Point, Size}; /// The content of a [`Pane`]. /// -/// [`Pane`]: struct.Pane.html +/// [`Pane`]: crate::widget::pane_grid::Pane #[allow(missing_debug_implementations)] pub struct Content<'a, Message, Renderer: pane_grid::Renderer> { title_bar: Option<TitleBar<'a, Message, Renderer>>, @@ -20,8 +20,6 @@ where Renderer: pane_grid::Renderer, { /// Creates a new [`Content`] with the provided body. - /// - /// [`Content`]: struct.Content.html pub fn new(body: impl Into<Element<'a, Message, Renderer>>) -> Self { Self { title_bar: None, @@ -31,9 +29,6 @@ where } /// Sets the [`TitleBar`] of this [`Content`]. - /// - /// [`TitleBar`]: struct.TitleBar.html - /// [`Content`]: struct.Content.html pub fn title_bar( mut self, title_bar: TitleBar<'a, Message, Renderer>, @@ -43,8 +38,6 @@ where } /// Sets the style of the [`Content`]. - /// - /// [`Content`]: struct.Content.html pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { self.style = style.into(); self @@ -57,9 +50,7 @@ where { /// Draws the [`Content`] with the provided [`Renderer`] and [`Layout`]. /// - /// [`Content`]: struct.Content.html - /// [`Renderer`]: trait.Renderer.html - /// [`Layout`]: ../layout/struct.Layout.html + /// [`Renderer`]: crate::widget::pane_grid::Renderer pub fn draw( &self, renderer: &mut Renderer, @@ -94,9 +85,6 @@ where /// Returns whether the [`Content`] with the given [`Layout`] can be picked /// at the provided cursor position. - /// - /// [`Content`]: struct.Content.html - /// [`Layout`]: ../layout/struct.Layout.html pub fn can_be_picked_at( &self, layout: Layout<'_>, diff --git a/native/src/widget/pane_grid/node.rs b/native/src/widget/pane_grid/node.rs index cbfd8a43..319936fc 100644 --- a/native/src/widget/pane_grid/node.rs +++ b/native/src/widget/pane_grid/node.rs @@ -7,17 +7,12 @@ use std::collections::HashMap; /// A layout node of a [`PaneGrid`]. /// -/// [`PaneGrid`]: struct.PaneGrid.html +/// [`PaneGrid`]: crate::widget::PaneGrid #[derive(Debug, Clone)] pub enum Node { /// The region of this [`Node`] is split into two. - /// - /// [`Node`]: enum.Node.html Split { /// The [`Split`] of this [`Node`]. - /// - /// [`Split`]: struct.Split.html - /// [`Node`]: enum.Node.html id: Split, /// The direction of the split. @@ -27,26 +22,17 @@ pub enum Node { ratio: f32, /// The left/top [`Node`] of the split. - /// - /// [`Node`]: enum.Node.html a: Box<Node>, /// The right/bottom [`Node`] of the split. - /// - /// [`Node`]: enum.Node.html b: Box<Node>, }, /// The region of this [`Node`] is taken by a [`Pane`]. - /// - /// [`Pane`]: struct.Pane.html Pane(Pane), } impl 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> { let mut unvisited_nodes = vec![self]; @@ -69,9 +55,6 @@ impl Node { /// Returns the rectangular region for each [`Pane`] in the [`Node`] given /// the spacing between panes and the total available space. - /// - /// [`Pane`]: struct.Pane.html - /// [`Node`]: enum.Node.html pub fn pane_regions( &self, spacing: f32, @@ -96,9 +79,6 @@ impl Node { /// Returns the axis, rectangular region, and ratio for each [`Split`] in /// the [`Node`] given the spacing between panes and the total available /// space. - /// - /// [`Split`]: struct.Split.html - /// [`Node`]: enum.Node.html pub fn split_regions( &self, spacing: f32, diff --git a/native/src/widget/pane_grid/pane.rs b/native/src/widget/pane_grid/pane.rs index f9866407..39d9f3ef 100644 --- a/native/src/widget/pane_grid/pane.rs +++ b/native/src/widget/pane_grid/pane.rs @@ -1,5 +1,5 @@ /// 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)] pub struct Pane(pub(super) usize); diff --git a/native/src/widget/pane_grid/split.rs b/native/src/widget/pane_grid/split.rs index d020c510..16975abc 100644 --- a/native/src/widget/pane_grid/split.rs +++ b/native/src/widget/pane_grid/split.rs @@ -1,5 +1,5 @@ /// 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)] pub struct Split(pub(super) usize); diff --git a/native/src/widget/pane_grid/state.rs b/native/src/widget/pane_grid/state.rs index 7a51781e..666e1ca0 100644 --- a/native/src/widget/pane_grid/state.rs +++ b/native/src/widget/pane_grid/state.rs @@ -15,11 +15,8 @@ use std::collections::HashMap; /// provided to the view function of [`PaneGrid::new`] for displaying each /// [`Pane`]. /// -/// [`PaneGrid`]: struct.PaneGrid.html -/// [`PaneGrid::new`]: struct.PaneGrid.html#method.new -/// [`Pane`]: struct.Pane.html -/// [`Split`]: struct.Split.html -/// [`State`]: struct.State.html +/// [`PaneGrid`]: crate::widget::PaneGrid +/// [`PaneGrid::new`]: crate::widget::PaneGrid::new #[derive(Debug, Clone)] pub struct State<T> { pub(super) panes: HashMap<Pane, T>, @@ -31,9 +28,6 @@ impl<T> State<T> { /// state. /// /// 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) { ( Self::with_configuration(Configuration::Pane(first_pane_state)), @@ -42,9 +36,6 @@ impl<T> State<T> { } /// 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 { let mut panes = HashMap::new(); @@ -62,54 +53,40 @@ impl<T> State<T> { } /// Returns the total amount of panes in the [`State`]. - /// - /// [`State`]: struct.State.html pub fn len(&self) -> usize { self.panes.len() } /// Returns the internal state of the given [`Pane`], if it exists. - /// - /// [`Pane`]: struct.Pane.html pub fn get(&self, pane: &Pane) -> Option<&T> { self.panes.get(pane) } /// Returns the internal state of the given [`Pane`] with mutability, if it /// exists. - /// - /// [`Pane`]: struct.Pane.html pub fn get_mut(&mut self, pane: &Pane) -> Option<&mut T> { self.panes.get_mut(pane) } /// Returns an iterator over all the panes of the [`State`], alongside its /// internal state. - /// - /// [`State`]: struct.State.html pub fn iter(&self) -> impl Iterator<Item = (&Pane, &T)> { self.panes.iter() } /// Returns a mutable iterator over all the panes of the [`State`], /// alongside its internal state. - /// - /// [`State`]: struct.State.html pub fn iter_mut(&mut self) -> impl Iterator<Item = (&Pane, &mut T)> { self.panes.iter_mut() } /// Returns the layout of the [`State`]. - /// - /// [`State`]: struct.State.html pub fn layout(&self) -> &Node { &self.internal.layout } /// Returns the adjacent [`Pane`] of another [`Pane`] in the given /// direction, if there is one. - /// - /// [`Pane`]: struct.Pane.html pub fn adjacent(&self, pane: &Pane, direction: Direction) -> Option<Pane> { let regions = self .internal @@ -145,9 +122,6 @@ impl<T> State<T> { /// Splits the given [`Pane`] into two in the given [`Axis`] and /// initializing the new [`Pane`] with the provided internal state. - /// - /// [`Pane`]: struct.Pane.html - /// [`Axis`]: enum.Axis.html pub fn split( &mut self, axis: Axis, @@ -180,9 +154,8 @@ impl<T> State<T> { /// If you want to swap panes on drag and drop in your [`PaneGrid`], you /// will need to call this method when handling a [`DragEvent`]. /// - /// [`State`]: struct.State.html - /// [`PaneGrid`]: struct.PaneGrid.html - /// [`DragEvent`]: struct.DragEvent.html + /// [`PaneGrid`]: crate::widget::PaneGrid + /// [`DragEvent`]: crate::widget::pane_grid::DragEvent pub fn swap(&mut self, a: &Pane, b: &Pane) { self.internal.layout.update(&|node| match node { Node::Split { .. } => {} @@ -204,17 +177,14 @@ impl<T> State<T> { /// If you want to enable resize interactions in your [`PaneGrid`], you will /// need to call this method when handling a [`ResizeEvent`]. /// - /// [`Split`]: struct.Split.html - /// [`PaneGrid`]: struct.PaneGrid.html - /// [`ResizeEvent`]: struct.ResizeEvent.html + /// [`PaneGrid`]: crate::widget::PaneGrid + /// [`ResizeEvent`]: crate::widget::pane_grid::ResizeEvent pub fn resize(&mut self, split: &Split, ratio: f32) { let _ = self.internal.layout.resize(split, ratio); } /// Closes the given [`Pane`] and returns its internal state and its closest /// sibling, if it exists. - /// - /// [`Pane`]: struct.Pane.html pub fn close(&mut self, pane: &Pane) -> Option<(T, Pane)> { if let Some(sibling) = self.internal.layout.remove(pane) { self.panes.remove(pane).map(|state| (state, sibling)) diff --git a/native/src/widget/pane_grid/title_bar.rs b/native/src/widget/pane_grid/title_bar.rs index f8ff43eb..475cb9ae 100644 --- a/native/src/widget/pane_grid/title_bar.rs +++ b/native/src/widget/pane_grid/title_bar.rs @@ -5,7 +5,7 @@ use crate::{Clipboard, Element, Hasher, Layout, Point, Rectangle, Size}; /// The title bar of a [`Pane`]. /// -/// [`Pane`]: struct.Pane.html +/// [`Pane`]: crate::widget::pane_grid::Pane #[allow(missing_debug_implementations)] pub struct TitleBar<'a, Message, Renderer: pane_grid::Renderer> { title: String, @@ -21,8 +21,6 @@ where Renderer: pane_grid::Renderer, { /// Creates a new [`TitleBar`] with the given title. - /// - /// [`TitleBar`]: struct.TitleBar.html pub fn new(title: impl Into<String>) -> Self { Self { title: title.into(), @@ -35,16 +33,12 @@ where } /// Sets the size of the title of the [`TitleBar`]. - /// - /// [`TitleBar`]: struct.TitleBar.html pub fn title_size(mut self, size: u16) -> Self { self.title_size = Some(size); self } /// Sets the controls of the [`TitleBar`]. - /// - /// [`TitleBar`]: struct.TitleBar.html pub fn controls( mut self, controls: impl Into<Element<'a, Message, Renderer>>, @@ -54,16 +48,12 @@ where } /// Sets the padding of the [`TitleBar`]. - /// - /// [`TitleBar`]: struct.TitleBar.html pub fn padding(mut self, units: u16) -> Self { self.padding = units; self } /// Sets the style of the [`TitleBar`]. - /// - /// [`TitleBar`]: struct.TitleBar.html pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { self.style = style.into(); self @@ -75,9 +65,8 @@ where /// By default, the controls are only visible when the [`Pane`] of this /// [`TitleBar`] is hovered. /// - /// [`TitleBar`]: struct.TitleBar.html - /// [`controls`]: struct.TitleBar.html#method.controls - /// [`Pane`]: struct.Pane.html + /// [`controls`]: Self::controls + /// [`Pane`]: crate::widget::pane_grid::Pane pub fn always_show_controls(mut self) -> Self { self.always_show_controls = true; self @@ -90,9 +79,7 @@ where { /// Draws the [`TitleBar`] with the provided [`Renderer`] and [`Layout`]. /// - /// [`TitleBar`]: struct.TitleBar.html - /// [`Renderer`]: trait.Renderer.html - /// [`Layout`]: ../layout/struct.Layout.html + /// [`Renderer`]: crate::widget::pane_grid::Renderer pub fn draw( &self, renderer: &mut Renderer, @@ -152,8 +139,6 @@ where /// [`TitleBar`] or not. /// /// The whole [`TitleBar`] is a pick area, except its controls. - /// - /// [`TitleBar`]: struct.TitleBar.html pub fn is_over_pick_area( &self, layout: Layout<'_>, diff --git a/native/src/widget/pick_list.rs b/native/src/widget/pick_list.rs index 113197f7..58c0dfe1 100644 --- a/native/src/widget/pick_list.rs +++ b/native/src/widget/pick_list.rs @@ -32,8 +32,6 @@ where } /// The local state of a [`PickList`]. -/// -/// [`PickList`]: struct.PickList.html #[derive(Debug, Clone)] pub struct State<T> { menu: menu::State, @@ -62,9 +60,6 @@ where /// 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 /// selected. - /// - /// [`PickList`]: struct.PickList.html - /// [`State`]: struct.State.html pub fn new( state: &'a mut State<T>, options: impl Into<Cow<'a, [T]>>, @@ -95,40 +90,30 @@ where } /// Sets the width of the [`PickList`]. - /// - /// [`PickList`]: struct.PickList.html pub fn width(mut self, width: Length) -> Self { self.width = width; self } /// Sets the padding of the [`PickList`]. - /// - /// [`PickList`]: struct.PickList.html pub fn padding(mut self, padding: u16) -> Self { self.padding = padding; self } /// Sets the text size of the [`PickList`]. - /// - /// [`PickList`]: struct.PickList.html pub fn text_size(mut self, size: u16) -> Self { self.text_size = Some(size); self } /// Sets the font of the [`PickList`]. - /// - /// [`PickList`]: struct.PickList.html pub fn font(mut self, font: Renderer::Font) -> Self { self.font = font; self } /// Sets the style of the [`PickList`]. - /// - /// [`PickList`]: struct.PickList.html pub fn style( mut self, style: impl Into<<Renderer as self::Renderer>::Style>, @@ -318,30 +303,20 @@ where /// Your [renderer] will need to implement this trait before being /// able to use a [`PickList`] in your user interface. /// -/// [`PickList`]: struct.PickList.html -/// [renderer]: ../../renderer/index.html +/// [renderer]: crate::renderer pub trait Renderer: text::Renderer + menu::Renderer { /// The default padding of a [`PickList`]. - /// - /// [`PickList`]: struct.PickList.html const DEFAULT_PADDING: u16; /// The [`PickList`] style supported by this renderer. - /// - /// [`PickList`]: struct.PickList.html type Style: Default; /// Returns the style of the [`Menu`] of the [`PickList`]. - /// - /// [`Menu`]: ../../overlay/menu/struct.Menu.html - /// [`PickList`]: struct.PickList.html fn menu_style( style: &<Self as Renderer>::Style, ) -> <Self as menu::Renderer>::Style; /// Draws a [`PickList`]. - /// - /// [`PickList`]: struct.PickList.html fn draw( &mut self, bounds: Rectangle, diff --git a/native/src/widget/progress_bar.rs b/native/src/widget/progress_bar.rs index 4f8a7e1b..d294f198 100644 --- a/native/src/widget/progress_bar.rs +++ b/native/src/widget/progress_bar.rs @@ -33,8 +33,6 @@ impl<Renderer: self::Renderer> ProgressBar<Renderer> { /// It expects: /// * an inclusive range of possible values /// * the current value of the [`ProgressBar`] - /// - /// [`ProgressBar`]: struct.ProgressBar.html pub fn new(range: RangeInclusive<f32>, value: f32) -> Self { ProgressBar { value: value.max(*range.start()).min(*range.end()), @@ -46,24 +44,18 @@ impl<Renderer: self::Renderer> ProgressBar<Renderer> { } /// Sets the width of the [`ProgressBar`]. - /// - /// [`ProgressBar`]: struct.ProgressBar.html pub fn width(mut self, width: Length) -> Self { self.width = width; self } /// Sets the height of the [`ProgressBar`]. - /// - /// [`ProgressBar`]: struct.ProgressBar.html pub fn height(mut self, height: Length) -> Self { self.height = Some(height); self } /// Sets the style of the [`ProgressBar`]. - /// - /// [`ProgressBar`]: struct.ProgressBar.html pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { self.style = style.into(); self @@ -128,15 +120,12 @@ where /// Your [renderer] will need to implement this trait before being /// able to use a [`ProgressBar`] in your user interface. /// -/// [`ProgressBar`]: struct.ProgressBar.html -/// [renderer]: ../../renderer/index.html +/// [renderer]: crate::renderer pub trait Renderer: crate::Renderer { /// The style supported by this renderer. type Style: Default; /// The default height of a [`ProgressBar`]. - /// - /// [`ProgressBar`]: struct.ProgressBar.html const DEFAULT_HEIGHT: u16; /// Draws a [`ProgressBar`]. @@ -147,8 +136,6 @@ pub trait Renderer: crate::Renderer { /// * the current value of the [`ProgressBar`] /// * maybe a specific background of the [`ProgressBar`] /// * maybe a specific active color of the [`ProgressBar`] - /// - /// [`ProgressBar`]: struct.ProgressBar.html fn draw( &self, bounds: Rectangle, diff --git a/native/src/widget/radio.rs b/native/src/widget/radio.rs index 781fffb1..4935569f 100644 --- a/native/src/widget/radio.rs +++ b/native/src/widget/radio.rs @@ -62,8 +62,6 @@ where /// * the current selected value /// * a function that will be called when the [`Radio`] is selected. It /// receives the value of the radio and must produce a `Message`. - /// - /// [`Radio`]: struct.Radio.html pub fn new<F, V>( value: V, label: impl Into<String>, @@ -87,40 +85,30 @@ where } /// Sets the size of the [`Radio`] button. - /// - /// [`Radio`]: struct.Radio.html pub fn size(mut self, size: u16) -> Self { self.size = size; self } /// Sets the width of the [`Radio`] button. - /// - /// [`Radio`]: struct.Radio.html pub fn width(mut self, width: Length) -> Self { self.width = width; self } /// Sets the spacing between the [`Radio`] button and the text. - /// - /// [`Radio`]: struct.Radio.html pub fn spacing(mut self, spacing: u16) -> Self { self.spacing = spacing; self } /// Sets the text size of the [`Radio`] button. - /// - /// [`Radio`]: struct.Radio.html pub fn text_size(mut self, text_size: u16) -> Self { self.text_size = Some(text_size); self } /// Sets the style of the [`Radio`] button. - /// - /// [`Radio`]: struct.Radio.html pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { self.style = style.into(); self @@ -237,20 +225,15 @@ where /// Your [renderer] will need to implement this trait before being /// able to use a [`Radio`] button in your user interface. /// -/// [`Radio`]: struct.Radio.html -/// [renderer]: ../../renderer/index.html +/// [renderer]: crate::renderer pub trait Renderer: crate::Renderer { /// The style supported by this renderer. type Style: Default; /// The default size of a [`Radio`] button. - /// - /// [`Radio`]: struct.Radio.html const DEFAULT_SIZE: u16; /// The default spacing of a [`Radio`] button. - /// - /// [`Radio`]: struct.Radio.html const DEFAULT_SPACING: u16; /// Draws a [`Radio`] button. @@ -260,8 +243,6 @@ pub trait Renderer: crate::Renderer { /// * whether the [`Radio`] is selected or not /// * whether the mouse is over the [`Radio`] or not /// * the drawn label of the [`Radio`] - /// - /// [`Radio`]: struct.Radio.html fn draw( &mut self, bounds: Rectangle, diff --git a/native/src/widget/row.rs b/native/src/widget/row.rs index 6b09d0c8..b71663bd 100644 --- a/native/src/widget/row.rs +++ b/native/src/widget/row.rs @@ -24,15 +24,11 @@ pub struct Row<'a, Message, Renderer> { impl<'a, Message, Renderer> Row<'a, Message, Renderer> { /// Creates an empty [`Row`]. - /// - /// [`Row`]: struct.Row.html pub fn new() -> Self { Self::with_children(Vec::new()) } /// Creates a [`Row`] with the given elements. - /// - /// [`Row`]: struct.Row.html pub fn with_children( children: Vec<Element<'a, Message, Renderer>>, ) -> Self { @@ -59,57 +55,42 @@ impl<'a, Message, Renderer> Row<'a, Message, Renderer> { } /// Sets the padding of the [`Row`]. - /// - /// [`Row`]: struct.Row.html pub fn padding(mut self, units: u16) -> Self { self.padding = units; self } /// Sets the width of the [`Row`]. - /// - /// [`Row`]: struct.Row.html pub fn width(mut self, width: Length) -> Self { self.width = width; self } /// Sets the height of the [`Row`]. - /// - /// [`Row`]: struct.Row.html pub fn height(mut self, height: Length) -> Self { self.height = height; self } /// Sets the maximum width of the [`Row`]. - /// - /// [`Row`]: struct.Row.html pub fn max_width(mut self, max_width: u32) -> Self { self.max_width = max_width; self } /// Sets the maximum height of the [`Row`]. - /// - /// [`Row`]: struct.Row.html pub fn max_height(mut self, max_height: u32) -> Self { self.max_height = max_height; self } /// Sets the vertical alignment of the contents of the [`Row`] . - /// - /// [`Row`]: struct.Row.html pub fn align_items(mut self, align: Align) -> Self { self.align_items = align; self } /// Adds an [`Element`] to the [`Row`]. - /// - /// [`Element`]: ../struct.Element.html - /// [`Row`]: struct.Row.html pub fn push<E>(mut self, child: E) -> Self where E: Into<Element<'a, Message, Renderer>>, @@ -230,8 +211,7 @@ where /// Your [renderer] will need to implement this trait before being /// able to use a [`Row`] in your user interface. /// -/// [`Row`]: struct.Row.html -/// [renderer]: ../../renderer/index.html +/// [renderer]: crate::renderer pub trait Renderer: crate::Renderer + Sized { /// Draws a [`Row`]. /// @@ -239,9 +219,6 @@ pub trait Renderer: crate::Renderer + Sized { /// - the children of the [`Row`] /// - the [`Layout`] of the [`Row`] and its children /// - the cursor position - /// - /// [`Row`]: struct.Row.html - /// [`Layout`]: ../layout/struct.Layout.html fn draw<Message>( &mut self, defaults: &Self::Defaults, diff --git a/native/src/widget/rule.rs b/native/src/widget/rule.rs index 66328c08..18c88658 100644 --- a/native/src/widget/rule.rs +++ b/native/src/widget/rule.rs @@ -17,8 +17,6 @@ pub struct Rule<Renderer: self::Renderer> { impl<Renderer: self::Renderer> Rule<Renderer> { /// Creates a horizontal [`Rule`] for dividing content by the given vertical spacing. - /// - /// [`Rule`]: struct.Rule.html pub fn horizontal(spacing: u16) -> Self { Rule { 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. - /// - /// [`Rule`]: struct.Rule.html pub fn vertical(spacing: u16) -> Self { Rule { width: Length::from(Length::Units(spacing)), @@ -41,8 +37,6 @@ impl<Renderer: self::Renderer> Rule<Renderer> { } /// Sets the style of the [`Rule`]. - /// - /// [`Rule`]: struct.Rule.html pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { self.style = style.into(); self @@ -92,8 +86,6 @@ where } /// The renderer of a [`Rule`]. -/// -/// [`Rule`]: struct.Rule.html pub trait Renderer: crate::Renderer { /// The style supported by this renderer. type Style: Default; @@ -104,8 +96,6 @@ pub trait Renderer: crate::Renderer { /// * the bounds of the [`Rule`] /// * the style of the [`Rule`] /// * whether the [`Rule`] is horizontal (true) or vertical (false) - /// - /// [`Rule`]: struct.Rule.html fn draw( &mut self, bounds: Rectangle, diff --git a/native/src/widget/scrollable.rs b/native/src/widget/scrollable.rs index 92671ddd..e23ab06a 100644 --- a/native/src/widget/scrollable.rs +++ b/native/src/widget/scrollable.rs @@ -27,9 +27,6 @@ pub struct Scrollable<'a, Message, Renderer: self::Renderer> { impl<'a, Message, Renderer: self::Renderer> Scrollable<'a, Message, Renderer> { /// Creates a new [`Scrollable`] with the given [`State`]. - /// - /// [`Scrollable`]: struct.Scrollable.html - /// [`State`]: struct.State.html pub fn new(state: &'a mut State) -> Self { Scrollable { state, @@ -54,48 +51,36 @@ impl<'a, Message, Renderer: self::Renderer> Scrollable<'a, Message, Renderer> { } /// Sets the padding of the [`Scrollable`]. - /// - /// [`Scrollable`]: struct.Scrollable.html pub fn padding(mut self, units: u16) -> Self { self.content = self.content.padding(units); self } /// Sets the width of the [`Scrollable`]. - /// - /// [`Scrollable`]: struct.Scrollable.html pub fn width(mut self, width: Length) -> Self { self.content = self.content.width(width); self } /// Sets the height of the [`Scrollable`]. - /// - /// [`Scrollable`]: struct.Scrollable.html pub fn height(mut self, height: Length) -> Self { self.height = height; self } /// Sets the maximum width of the [`Scrollable`]. - /// - /// [`Scrollable`]: struct.Scrollable.html pub fn max_width(mut self, max_width: u32) -> Self { self.content = self.content.max_width(max_width); self } /// Sets the maximum height of the [`Scrollable`] in pixels. - /// - /// [`Scrollable`]: struct.Scrollable.html pub fn max_height(mut self, max_height: u32) -> Self { self.max_height = max_height; self } /// Sets the horizontal alignment of the contents of the [`Scrollable`] . - /// - /// [`Scrollable`]: struct.Scrollable.html pub fn align_items(mut self, align_items: Align) -> Self { self.content = self.content.align_items(align_items); self @@ -103,16 +88,12 @@ impl<'a, Message, Renderer: self::Renderer> Scrollable<'a, Message, Renderer> { /// Sets the scrollbar width of the [`Scrollable`] . /// Silently enforces a minimum value of 1. - /// - /// [`Scrollable`]: struct.Scrollable.html pub fn scrollbar_width(mut self, scrollbar_width: u16) -> Self { self.scrollbar_width = scrollbar_width.max(1); self } /// Sets the scrollbar margin of the [`Scrollable`] . - /// - /// [`Scrollable`]: struct.Scrollable.html pub fn scrollbar_margin(mut self, scrollbar_margin: u16) -> Self { self.scrollbar_margin = scrollbar_margin; self @@ -120,24 +101,18 @@ impl<'a, Message, Renderer: self::Renderer> Scrollable<'a, Message, Renderer> { /// Sets the scroller width of the [`Scrollable`] . /// Silently enforces a minimum value of 1. - /// - /// [`Scrollable`]: struct.Scrollable.html pub fn scroller_width(mut self, scroller_width: u16) -> Self { self.scroller_width = scroller_width.max(1); self } /// Sets the style of the [`Scrollable`] . - /// - /// [`Scrollable`]: struct.Scrollable.html pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { self.style = style.into(); self } /// Adds an element to the [`Scrollable`]. - /// - /// [`Scrollable`]: struct.Scrollable.html pub fn push<E>(mut self, child: E) -> Self where E: Into<Element<'a, Message, Renderer>>, @@ -407,8 +382,6 @@ where } /// The local state of a [`Scrollable`]. -/// -/// [`Scrollable`]: struct.Scrollable.html #[derive(Debug, Clone, Copy, Default)] pub struct State { scroller_grabbed_at: Option<f32>, @@ -417,17 +390,12 @@ pub struct State { impl State { /// Creates a new [`State`] with the scrollbar located at the top. - /// - /// [`State`]: struct.State.html pub fn new() -> Self { State::default() } /// Apply a scrolling offset to the current [`State`], given the bounds of /// the [`Scrollable`] and its contents. - /// - /// [`Scrollable`]: struct.Scrollable.html - /// [`State`]: struct.State.html pub fn scroll( &mut self, delta_y: f32, @@ -448,9 +416,6 @@ impl State { /// /// `0` represents scrollbar at the top, while `1` represents scrollbar at /// the bottom. - /// - /// [`Scrollable`]: struct.Scrollable.html - /// [`State`]: struct.State.html pub fn scroll_to( &mut self, percentage: f32, @@ -463,9 +428,6 @@ impl State { /// Returns the current scrolling offset of the [`State`], given the bounds /// of the [`Scrollable`] and its contents. - /// - /// [`Scrollable`]: struct.Scrollable.html - /// [`State`]: struct.State.html pub fn offset(&self, bounds: Rectangle, content_bounds: Rectangle) -> u32 { let hidden_content = (content_bounds.height - bounds.height).max(0.0).round() as u32; @@ -480,30 +442,19 @@ impl State { } /// The scrollbar of a [`Scrollable`]. -/// -/// [`Scrollable`]: struct.Scrollable.html #[derive(Debug)] pub struct Scrollbar { /// The outer bounds of the scrollable, including the [`Scrollbar`] and /// [`Scroller`]. - /// - /// [`Scrollbar`]: struct.Scrollbar.html - /// [`Scroller`]: struct.Scroller.html pub outer_bounds: Rectangle, /// The bounds of the [`Scrollbar`]. - /// - /// [`Scrollbar`]: struct.Scrollbar.html pub bounds: Rectangle, /// The margin within the [`Scrollbar`]. - /// - /// [`Scrollbar`]: struct.Scrollbar.html pub margin: u16, /// The bounds of the [`Scroller`]. - /// - /// [`Scroller`]: struct.Scroller.html pub scroller: Scroller, } @@ -538,13 +489,9 @@ impl Scrollbar { } /// The handle of a [`Scrollbar`]. -/// -/// [`Scrollbar`]: struct.Scrollbar.html #[derive(Debug, Clone, Copy)] pub struct Scroller { /// The bounds of the [`Scroller`]. - /// - /// [`Scroller`]: struct.Scrollbar.html pub bounds: Rectangle, } @@ -553,17 +500,13 @@ pub struct Scroller { /// Your [renderer] will need to implement this trait before being /// able to use a [`Scrollable`] in your user interface. /// -/// [`Scrollable`]: struct.Scrollable.html -/// [renderer]: ../../renderer/index.html +/// [renderer]: crate::renderer pub trait Renderer: column::Renderer + Sized { /// The style supported by this renderer. type Style: Default; /// Returns the [`Scrollbar`] given the bounds and content bounds of a /// [`Scrollable`]. - /// - /// [`Scrollbar`]: struct.Scrollbar.html - /// [`Scrollable`]: struct.Scrollable.html fn scrollbar( &self, bounds: Rectangle, @@ -585,10 +528,6 @@ pub trait Renderer: column::Renderer + Sized { /// - a optional [`Scrollbar`] to be rendered /// - the scrolling offset /// - the drawn content - /// - /// [`Scrollbar`]: struct.Scrollbar.html - /// [`Scrollable`]: struct.Scrollable.html - /// [`State`]: struct.State.html fn draw( &mut self, scrollable: &State, diff --git a/native/src/widget/slider.rs b/native/src/widget/slider.rs index 4e38fb86..ff39b816 100644 --- a/native/src/widget/slider.rs +++ b/native/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::event::{self, Event}; use crate::layout; 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 /// to 1 unit. /// -/// [`Slider`]: struct.Slider.html -/// /// # Example /// ``` /// # use iced_native::{slider, renderer::Null}; @@ -68,9 +63,6 @@ where /// * a function that will be called when the [`Slider`] is dragged. /// It receives the new value of the [`Slider`] and must produce a /// `Message`. - /// - /// [`Slider`]: struct.Slider.html - /// [`State`]: struct.State.html pub fn new<F>( state: &'a mut State, range: RangeInclusive<T>, @@ -111,40 +103,30 @@ where /// 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 /// the default on_change message could create too many events. - /// - /// [`Slider`]: struct.Slider.html pub fn on_release(mut self, on_release: Message) -> Self { self.on_release = Some(on_release); self } /// Sets the width of the [`Slider`]. - /// - /// [`Slider`]: struct.Slider.html pub fn width(mut self, width: Length) -> Self { self.width = width; self } /// Sets the height of the [`Slider`]. - /// - /// [`Slider`]: struct.Slider.html pub fn height(mut self, height: u16) -> Self { self.height = height; self } /// Sets the style of the [`Slider`]. - /// - /// [`Slider`]: struct.Slider.html pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { self.style = style.into(); self } /// Sets the step size of the [`Slider`]. - /// - /// [`Slider`]: struct.Slider.html pub fn step(mut self, step: T) -> Self { self.step = step; self @@ -152,8 +134,6 @@ where } /// The local state of a [`Slider`]. -/// -/// [`Slider`]: struct.Slider.html #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] pub struct State { is_dragging: bool, @@ -161,8 +141,6 @@ pub struct State { impl State { /// Creates a new [`State`]. - /// - /// [`State`]: struct.State.html pub fn new() -> State { State::default() } @@ -297,15 +275,12 @@ where /// Your [renderer] will need to implement this trait before being /// able to use a [`Slider`] in your user interface. /// -/// [`Slider`]: struct.Slider.html -/// [renderer]: ../../renderer/index.html +/// [renderer]: crate::renderer pub trait Renderer: crate::Renderer { /// The style supported by this renderer. type Style: Default; /// The default height of a [`Slider`]. - /// - /// [`Slider`]: struct.Slider.html const DEFAULT_HEIGHT: u16; /// Draws a [`Slider`]. @@ -316,10 +291,6 @@ pub trait Renderer: crate::Renderer { /// * the local state of the [`Slider`] /// * the range of values of the [`Slider`] /// * the current value of the [`Slider`] - /// - /// [`Slider`]: struct.Slider.html - /// [`State`]: struct.State.html - /// [`Class`]: enum.Class.html fn draw( &mut self, bounds: Rectangle, diff --git a/native/src/widget/space.rs b/native/src/widget/space.rs index 032f341d..6b34ece8 100644 --- a/native/src/widget/space.rs +++ b/native/src/widget/space.rs @@ -16,15 +16,11 @@ pub struct Space { impl Space { /// Creates an amount of empty [`Space`] with the given width and height. - /// - /// [`Space`]: struct.Space.html pub fn new(width: Length, height: Length) -> Self { Space { width, height } } /// Creates an amount of horizontal [`Space`]. - /// - /// [`Space`]: struct.Space.html pub fn with_width(width: Length) -> Self { Space { width, @@ -33,8 +29,6 @@ impl Space { } /// Creates an amount of vertical [`Space`]. - /// - /// [`Space`]: struct.Space.html pub fn with_height(height: Length) -> Self { Space { width: Length::Shrink, @@ -85,14 +79,10 @@ where } /// The renderer of an amount of [`Space`]. -/// -/// [`Space`]: struct.Space.html pub trait Renderer: crate::Renderer { /// Draws an amount of empty [`Space`]. /// /// You should most likely return an empty primitive here. - /// - /// [`Space`]: struct.Space.html fn draw(&mut self, bounds: Rectangle) -> Self::Output; } diff --git a/native/src/widget/svg.rs b/native/src/widget/svg.rs index ede1aff8..9cd61918 100644 --- a/native/src/widget/svg.rs +++ b/native/src/widget/svg.rs @@ -14,8 +14,6 @@ use std::{ /// /// [`Svg`] images can have a considerable rendering cost when resized, /// specially when they are complex. -/// -/// [`Svg`]: struct.Svg.html #[derive(Debug, Clone)] pub struct Svg { handle: Handle, @@ -25,9 +23,6 @@ pub struct Svg { impl Svg { /// Creates a new [`Svg`] from the given [`Handle`]. - /// - /// [`Svg`]: struct.Svg.html - /// [`Handle`]: struct.Handle.html pub fn new(handle: impl Into<Handle>) -> Self { Svg { handle: handle.into(), @@ -38,23 +33,17 @@ impl Svg { /// Creates a new [`Svg`] that will display the contents of the file at the /// provided path. - /// - /// [`Svg`]: struct.Svg.html pub fn from_path(path: impl Into<PathBuf>) -> Self { Self::new(Handle::from_path(path)) } /// Sets the width of the [`Svg`]. - /// - /// [`Svg`]: struct.Svg.html pub fn width(mut self, width: Length) -> Self { self.width = width; self } /// Sets the height of the [`Svg`]. - /// - /// [`Svg`]: struct.Svg.html pub fn height(mut self, height: Length) -> Self { self.height = height; self @@ -119,8 +108,6 @@ where } /// An [`Svg`] handle. -/// -/// [`Svg`]: struct.Svg.html #[derive(Debug, Clone)] pub struct Handle { id: u64, @@ -130,8 +117,6 @@ pub struct Handle { impl Handle { /// Creates an SVG [`Handle`] pointing to the vector image of the given /// path. - /// - /// [`Handle`]: struct.Handle.html pub fn from_path(path: impl Into<PathBuf>) -> Handle { 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 /// because you downloaded or generated it procedurally. - /// - /// [`Handle`]: struct.Handle.html pub fn from_memory(bytes: impl Into<Vec<u8>>) -> Handle { Self::from_data(Data::Bytes(bytes.into())) } @@ -158,15 +141,11 @@ impl Handle { } /// Returns the unique identifier of the [`Handle`]. - /// - /// [`Handle`]: struct.Handle.html pub fn id(&self) -> u64 { self.id } /// Returns a reference to the SVG [`Data`]. - /// - /// [`Data`]: enum.Data.html pub fn data(&self) -> &Data { &self.data } @@ -179,8 +158,6 @@ impl Hash for Handle { } /// The data of an [`Svg`]. -/// -/// [`Svg`]: struct.Svg.html #[derive(Clone, Hash)] pub enum 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 /// an [`Svg`] in your user interface. /// -/// [`Svg`]: struct.Svg.html -/// [renderer]: ../../renderer/index.html +/// [renderer]: crate::renderer pub trait Renderer: crate::Renderer { /// 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); /// Draws an [`Svg`]. - /// - /// [`Svg`]: struct.Svg.html fn draw(&mut self, handle: Handle, layout: Layout<'_>) -> Self::Output; } diff --git a/native/src/widget/text.rs b/native/src/widget/text.rs index c2544b8e..6cc18e6c 100644 --- a/native/src/widget/text.rs +++ b/native/src/widget/text.rs @@ -33,8 +33,6 @@ pub struct Text<Renderer: self::Renderer> { impl<Renderer: self::Renderer> Text<Renderer> { /// Create a new fragment of [`Text`] with the given contents. - /// - /// [`Text`]: struct.Text.html pub fn new<T: Into<String>>(label: T) -> Self { Text { content: label.into(), @@ -49,17 +47,12 @@ impl<Renderer: self::Renderer> Text<Renderer> { } /// Sets the size of the [`Text`]. - /// - /// [`Text`]: struct.Text.html pub fn size(mut self, size: u16) -> Self { self.size = Some(size); self } /// 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 { self.color = Some(color.into()); self @@ -67,33 +60,25 @@ impl<Renderer: self::Renderer> Text<Renderer> { /// Sets the [`Font`] of the [`Text`]. /// - /// [`Text`]: struct.Text.html - /// [`Font`]: ../../struct.Font.html + /// [`Font`]: Renderer::Font pub fn font(mut self, font: impl Into<Renderer::Font>) -> Self { self.font = font.into(); self } /// Sets the width of the [`Text`] boundaries. - /// - /// [`Text`]: struct.Text.html pub fn width(mut self, width: Length) -> Self { self.width = width; self } /// Sets the height of the [`Text`] boundaries. - /// - /// [`Text`]: struct.Text.html pub fn height(mut self, height: Length) -> Self { self.height = height; self } /// Sets the [`HorizontalAlignment`] of the [`Text`]. - /// - /// [`Text`]: struct.Text.html - /// [`HorizontalAlignment`]: enum.HorizontalAlignment.html pub fn horizontal_alignment( mut self, alignment: HorizontalAlignment, @@ -103,9 +88,6 @@ impl<Renderer: self::Renderer> Text<Renderer> { } /// Sets the [`VerticalAlignment`] of the [`Text`]. - /// - /// [`Text`]: struct.Text.html - /// [`VerticalAlignment`]: enum.VerticalAlignment.html pub fn vertical_alignment(mut self, alignment: VerticalAlignment) -> Self { self.vertical_alignment = alignment; self @@ -177,26 +159,18 @@ where /// The renderer of a [`Text`] fragment. /// /// 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]: ../../renderer/index.html -/// [`UserInterface`]: ../../struct.UserInterface.html +/// [renderer]: crate::Renderer pub trait Renderer: crate::Renderer { /// The font type used for [`Text`]. - /// - /// [`Text`]: struct.Text.html type Font: Default + Copy; /// Returns the default size of [`Text`]. - /// - /// [`Text`]: struct.Text.html fn default_size(&self) -> u16; /// Measures the [`Text`] in the given bounds and returns the minimum /// boundaries that can fit the contents. - /// - /// [`Text`]: struct.Text.html fn measure( &self, content: &str, @@ -214,10 +188,6 @@ pub trait Renderer: crate::Renderer { /// * the color of the [`Text`] /// * the [`HorizontalAlignment`] of the [`Text`] /// * the [`VerticalAlignment`] of the [`Text`] - /// - /// [`Text`]: struct.Text.html - /// [`HorizontalAlignment`]: enum.HorizontalAlignment.html - /// [`VerticalAlignment`]: enum.VerticalAlignment.html fn draw( &mut self, defaults: &Self::Defaults, diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs index a302e483..3e637e97 100644 --- a/native/src/widget/text_input.rs +++ b/native/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 mod editor; mod value; @@ -77,9 +74,6 @@ where /// - a placeholder /// - the current value /// - a function that produces a message when the [`TextInput`] changes - /// - /// [`TextInput`]: struct.TextInput.html - /// [`State`]: struct.State.html pub fn new<F>( state: &'a mut State, placeholder: &str, @@ -106,8 +100,6 @@ where } /// Converts the [`TextInput`] into a secure password input. - /// - /// [`TextInput`]: struct.TextInput.html pub fn password(mut self) -> Self { self.is_secure = true; self @@ -115,39 +107,31 @@ where /// Sets the [`Font`] of the [`Text`]. /// - /// [`Text`]: struct.Text.html - /// [`Font`]: ../../struct.Font.html + /// [`Font`]: crate::widget::text::Renderer::Font + /// [`Text`]: crate::widget::Text pub fn font(mut self, font: Renderer::Font) -> Self { self.font = font; self } /// Sets the width of the [`TextInput`]. - /// - /// [`TextInput`]: struct.TextInput.html pub fn width(mut self, width: Length) -> Self { self.width = width; self } /// Sets the maximum width of the [`TextInput`]. - /// - /// [`TextInput`]: struct.TextInput.html pub fn max_width(mut self, max_width: u32) -> Self { self.max_width = max_width; self } /// Sets the padding of the [`TextInput`]. - /// - /// [`TextInput`]: struct.TextInput.html pub fn padding(mut self, units: u16) -> Self { self.padding = units; self } /// Sets the text size of the [`TextInput`]. - /// - /// [`TextInput`]: struct.TextInput.html pub fn size(mut self, size: u16) -> Self { self.size = Some(size); self @@ -155,26 +139,18 @@ where /// Sets the message that should be produced when the [`TextInput`] is /// focused and the enter key is pressed. - /// - /// [`TextInput`]: struct.TextInput.html pub fn on_submit(mut self, message: Message) -> Self { self.on_submit = Some(message); self } /// 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 { self.style = style.into(); self } /// Returns the current [`State`] of the [`TextInput`]. - /// - /// [`TextInput`]: struct.TextInput.html - /// [`State`]: struct.State.html pub fn state(&self) -> &State { self.state } @@ -186,10 +162,6 @@ where { /// Draws the [`TextInput`] with the given [`Renderer`], overriding its /// [`Value`] if provided. - /// - /// [`TextInput`]: struct.TextInput.html - /// [`Renderer`]: trait.Render.html - /// [`Value`]: struct.Value.html pub fn draw( &self, renderer: &mut Renderer, @@ -570,7 +542,7 @@ where self.state.is_pasting = None; self.state.keyboard_modifiers = - keyboard::ModifiersState::default(); + keyboard::Modifiers::default(); } _ => {} } @@ -628,15 +600,12 @@ where /// Your [renderer] will need to implement this trait before being /// able to use a [`TextInput`] in your user interface. /// -/// [`TextInput`]: struct.TextInput.html -/// [renderer]: ../../renderer/index.html +/// [renderer]: crate::renderer pub trait Renderer: text::Renderer + Sized { /// The style supported by this renderer. type Style: Default; /// 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; /// 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`] /// does not fit the [`TextInput`]. - /// - /// [`TextInput`]: struct.TextInput.html - /// [`Value`]: struct.Value.html fn offset( &self, text_bounds: Rectangle, @@ -665,10 +631,6 @@ pub trait Renderer: text::Renderer + Sized { /// - the placeholder to show when the value is empty /// - the current [`Value`] /// - the current [`State`] - /// - /// [`TextInput`]: struct.TextInput.html - /// [`Value`]: struct.Value.html - /// [`State`]: struct.State.html fn draw( &mut self, 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 /// a [`TextInput`]. - /// - /// [`TextInput`]: struct.TextInput.html fn find_cursor_position( &self, text_bounds: Rectangle, @@ -725,8 +685,6 @@ where } /// The state of a [`TextInput`]. -/// -/// [`TextInput`]: struct.TextInput.html #[derive(Debug, Default, Clone)] pub struct State { is_focused: bool, @@ -734,21 +692,17 @@ pub struct State { is_pasting: Option<Value>, last_click: Option<mouse::Click>, cursor: Cursor, - keyboard_modifiers: keyboard::ModifiersState, + keyboard_modifiers: keyboard::Modifiers, // TODO: Add stateful horizontal scrolling offset } impl State { /// Creates a new [`State`], representing an unfocused [`TextInput`]. - /// - /// [`State`]: struct.State.html pub fn new() -> Self { Self::default() } /// Creates a new [`State`], representing a focused [`TextInput`]. - /// - /// [`State`]: struct.State.html pub fn focused() -> Self { Self { is_focused: true, @@ -756,59 +710,41 @@ impl State { is_pasting: None, last_click: None, cursor: Cursor::default(), - keyboard_modifiers: keyboard::ModifiersState::default(), + keyboard_modifiers: keyboard::Modifiers::default(), } } /// Returns whether the [`TextInput`] is currently focused or not. - /// - /// [`TextInput`]: struct.TextInput.html pub fn is_focused(&self) -> bool { self.is_focused } /// Returns the [`Cursor`] of the [`TextInput`]. - /// - /// [`Cursor`]: struct.Cursor.html - /// [`TextInput`]: struct.TextInput.html pub fn cursor(&self) -> Cursor { self.cursor } /// Focuses the [`TextInput`]. - /// - /// [`TextInput`]: struct.TextInput.html pub fn focus(&mut self) { self.is_focused = true; } /// Unfocuses the [`TextInput`]. - /// - /// [`TextInput`]: struct.TextInput.html pub fn unfocus(&mut self) { self.is_focused = false; } /// 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) { self.cursor.move_to(0); } /// 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) { self.cursor.move_to(usize::MAX); } /// 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) { self.cursor.move_to(position); } @@ -873,9 +809,7 @@ fn find_cursor_position<Renderer: self::Renderer>( mod platform { use crate::keyboard; - pub fn is_jump_modifier_pressed( - modifiers: keyboard::ModifiersState, - ) -> bool { + pub fn is_jump_modifier_pressed(modifiers: keyboard::Modifiers) -> bool { if cfg!(target_os = "macos") { modifiers.alt } else { diff --git a/native/src/widget/text_input/cursor.rs b/native/src/widget/text_input/cursor.rs index aa03bb74..e630e293 100644 --- a/native/src/widget/text_input/cursor.rs +++ b/native/src/widget/text_input/cursor.rs @@ -8,8 +8,6 @@ pub struct Cursor { } /// The state of a [`Cursor`]. -/// -/// [`Cursor`]: struct.Cursor.html #[derive(Debug, Copy, Clone)] pub enum State { /// Cursor without a selection @@ -34,9 +32,6 @@ impl Default for Cursor { impl Cursor { /// Returns the [`State`] of the [`Cursor`]. - /// - /// [`State`]: struct.State.html - /// [`Cursor`]: struct.Cursor.html pub fn state(&self, value: &Value) -> State { match self.state { State::Index(index) => State::Index(index.min(value.len())), diff --git a/native/src/widget/text_input/value.rs b/native/src/widget/text_input/value.rs index 8df74e0c..86be2790 100644 --- a/native/src/widget/text_input/value.rs +++ b/native/src/widget/text_input/value.rs @@ -2,7 +2,7 @@ use unicode_segmentation::UnicodeSegmentation; /// The value of a [`TextInput`]. /// -/// [`TextInput`]: struct.TextInput.html +/// [`TextInput`]: crate::widget::TextInput // TODO: Reduce allocations, cache results (?) #[derive(Debug, Clone)] pub struct Value { @@ -11,8 +11,6 @@ pub struct Value { impl Value { /// Creates a new [`Value`] from a string slice. - /// - /// [`Value`]: struct.Value.html pub fn new(string: &str) -> Self { let graphemes = UnicodeSegmentation::graphemes(string, true) .map(String::from) @@ -24,23 +22,17 @@ impl Value { /// Returns whether the [`Value`] is empty or not. /// /// A [`Value`] is empty when it contains no graphemes. - /// - /// [`Value`]: struct.Value.html pub fn is_empty(&self) -> bool { self.len() == 0 } /// Returns the total amount of graphemes in the [`Value`]. - /// - /// [`Value`]: struct.Value.html pub fn len(&self) -> usize { self.graphemes.len() } /// Returns the position of the previous start of a word from the given /// grapheme `index`. - /// - /// [`Value`]: struct.Value.html pub fn previous_start_of_word(&self, index: usize) -> usize { let previous_string = &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 /// `index`. - /// - /// [`Value`]: struct.Value.html pub fn next_end_of_word(&self, index: usize) -> usize { let next_string = &self.graphemes[index..].concat(); @@ -85,8 +75,6 @@ impl Value { /// Returns a new [`Value`] containing the graphemes until the given /// `index`. - /// - /// [`Value`]: struct.Value.html pub fn until(&self, index: usize) -> Self { let graphemes = self.graphemes[..index.min(self.len())].to_vec(); @@ -94,8 +82,6 @@ impl Value { } /// Converts the [`Value`] into a `String`. - /// - /// [`Value`]: struct.Value.html pub fn to_string(&self) -> String { self.graphemes.concat() } @@ -118,8 +104,6 @@ impl Value { } /// Removes the grapheme at the given `index`. - /// - /// [`Value`]: struct.Value.html pub fn remove(&mut self, index: usize) { let _ = self.graphemes.remove(index); } @@ -131,8 +115,6 @@ impl Value { /// Returns a new [`Value`] with all its graphemes replaced with the /// dot ('•') character. - /// - /// [`Value`]: struct.Value.html pub fn secure(&self) -> Self { Self { graphemes: std::iter::repeat(String::from("•")) |