summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-01-09 18:31:07 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-01-09 18:31:07 +0100
commit7b278755fc7929633b5771824beac4d39b16e82e (patch)
treefe3a8a6b0ae82f7fd1fa0c0de34b4b09d0b9edda
parent775500cf1f5a14afacdc0bb6875136a4fd3369a4 (diff)
downloadiced-7b278755fc7929633b5771824beac4d39b16e82e.tar.gz
iced-7b278755fc7929633b5771824beac4d39b16e82e.tar.bz2
iced-7b278755fc7929633b5771824beac4d39b16e82e.zip
Write missing docs and reenable deny statements
-rw-r--r--native/src/lib.rs2
-rw-r--r--native/src/renderer.rs5
-rw-r--r--native/src/renderer/null.rs3
-rw-r--r--native/src/renderer/windowed.rs1
-rw-r--r--native/src/widget/button.rs4
-rw-r--r--native/src/widget/checkbox.rs1
-rw-r--r--native/src/widget/container.rs8
-rw-r--r--native/src/widget/progress_bar.rs1
-rw-r--r--native/src/widget/radio.rs1
-rw-r--r--native/src/widget/scrollable.rs1
-rw-r--r--native/src/widget/slider.rs1
-rw-r--r--native/src/widget/text_input.rs1
-rw-r--r--src/lib.rs2
-rw-r--r--src/settings.rs14
-rw-r--r--wgpu/src/defaults.rs5
-rw-r--r--wgpu/src/lib.rs2
-rw-r--r--wgpu/src/settings.rs6
-rw-r--r--wgpu/src/widget.rs26
18 files changed, 71 insertions, 13 deletions
diff --git a/native/src/lib.rs b/native/src/lib.rs
index 9d237196..8dcacb2b 100644
--- a/native/src/lib.rs
+++ b/native/src/lib.rs
@@ -34,7 +34,7 @@
//! [`Windowed`]: renderer/trait.Windowed.html
//! [`UserInterface`]: struct.UserInterface.html
//! [renderer]: renderer/index.html
-//#![deny(missing_docs)]
+#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![deny(unused_results)]
#![deny(unsafe_code)]
diff --git a/native/src/renderer.rs b/native/src/renderer.rs
index 90cec6c8..284c95f6 100644
--- a/native/src/renderer.rs
+++ b/native/src/renderer.rs
@@ -44,6 +44,11 @@ pub trait Renderer: Sized {
/// [`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 bd5bba23..df261cdc 100644
--- a/native/src/renderer/null.rs
+++ b/native/src/renderer/null.rs
@@ -11,6 +11,9 @@ use crate::{
pub struct Null;
impl Null {
+ /// Creates a new [`Null`] renderer.
+ ///
+ /// [`Null`]: struct.Null.html
pub fn new() -> Null {
Null
}
diff --git a/native/src/renderer/windowed.rs b/native/src/renderer/windowed.rs
index c3266e6c..ee020ab1 100644
--- a/native/src/renderer/windowed.rs
+++ b/native/src/renderer/windowed.rs
@@ -4,6 +4,7 @@ use raw_window_handle::HasRawWindowHandle;
/// A renderer that can target windows.
pub trait Windowed: super::Renderer + Sized {
+ /// The settings of the renderer.
type Settings: Default;
/// The type of target.
diff --git a/native/src/widget/button.rs b/native/src/widget/button.rs
index 75ef2693..51b02172 100644
--- a/native/src/widget/button.rs
+++ b/native/src/widget/button.rs
@@ -114,6 +114,9 @@ where
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
@@ -246,6 +249,7 @@ where
/// [`Button`]: struct.Button.html
/// [renderer]: ../../renderer/index.html
pub trait Renderer: crate::Renderer + Sized {
+ /// The style supported by this renderer.
type Style: Default;
/// Draws a [`Button`].
diff --git a/native/src/widget/checkbox.rs b/native/src/widget/checkbox.rs
index d88a59f4..95165997 100644
--- a/native/src/widget/checkbox.rs
+++ b/native/src/widget/checkbox.rs
@@ -183,6 +183,7 @@ where
/// [`Checkbox`]: struct.Checkbox.html
/// [renderer]: ../../renderer/index.html
pub trait Renderer: crate::Renderer {
+ /// The style supported by this renderer.
type Style: Default;
/// Returns the default size of a [`Checkbox`].
diff --git a/native/src/widget/container.rs b/native/src/widget/container.rs
index abe83264..5682fc87 100644
--- a/native/src/widget/container.rs
+++ b/native/src/widget/container.rs
@@ -183,7 +183,15 @@ where
}
}
+/// The renderer of a [`Container`].
+///
+/// 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
pub trait Renderer: crate::Renderer {
+ /// The style supported by this renderer.
type Style: Default;
/// Draws a [`Container`].
diff --git a/native/src/widget/progress_bar.rs b/native/src/widget/progress_bar.rs
index 0bc860dd..67d1ab83 100644
--- a/native/src/widget/progress_bar.rs
+++ b/native/src/widget/progress_bar.rs
@@ -127,6 +127,7 @@ where
/// [`ProgressBar`]: struct.ProgressBar.html
/// [renderer]: ../../renderer/index.html
pub trait Renderer: crate::Renderer {
+ /// The style supported by this renderer.
type Style: Default;
/// The default height of a [`ProgressBar`].
diff --git a/native/src/widget/radio.rs b/native/src/widget/radio.rs
index b0a6080b..99743ec3 100644
--- a/native/src/widget/radio.rs
+++ b/native/src/widget/radio.rs
@@ -181,6 +181,7 @@ where
/// [`Radio`]: struct.Radio.html
/// [renderer]: ../../renderer/index.html
pub trait Renderer: crate::Renderer {
+ /// The style supported by this renderer.
type Style: Default;
/// Returns the default size of a [`Radio`] button.
diff --git a/native/src/widget/scrollable.rs b/native/src/widget/scrollable.rs
index a062abd0..e83f25af 100644
--- a/native/src/widget/scrollable.rs
+++ b/native/src/widget/scrollable.rs
@@ -458,6 +458,7 @@ pub struct Scroller {
/// [`Scrollable`]: struct.Scrollable.html
/// [renderer]: ../../renderer/index.html
pub trait Renderer: crate::Renderer + Sized {
+ /// The style supported by this renderer.
type Style: Default;
/// Returns the [`Scrollbar`] given the bounds and content bounds of a
diff --git a/native/src/widget/slider.rs b/native/src/widget/slider.rs
index c35a933e..008203fe 100644
--- a/native/src/widget/slider.rs
+++ b/native/src/widget/slider.rs
@@ -217,6 +217,7 @@ where
/// [`Slider`]: struct.Slider.html
/// [renderer]: ../../renderer/index.html
pub trait Renderer: crate::Renderer {
+ /// The style supported by this renderer.
type Style: Default;
/// Returns the height of the [`Slider`].
diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs
index efbd65c8..25032559 100644
--- a/native/src/widget/text_input.rs
+++ b/native/src/widget/text_input.rs
@@ -407,6 +407,7 @@ where
/// [`TextInput`]: struct.TextInput.html
/// [renderer]: ../../renderer/index.html
pub trait Renderer: crate::Renderer + Sized {
+ /// The style supported by this renderer.
type Style: Default;
/// Returns the default size of the text of the [`TextInput`].
diff --git a/src/lib.rs b/src/lib.rs
index 579ff43d..1ef11378 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -174,7 +174,7 @@
//! [documentation]: https://docs.rs/iced
//! [examples]: https://github.com/hecrj/iced/tree/master/examples
//! [`Application`]: trait.Application.html
-//#![deny(missing_docs)]
+#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![deny(unused_results)]
#![deny(unsafe_code)]
diff --git a/src/settings.rs b/src/settings.rs
index b725ef9f..e20edc97 100644
--- a/src/settings.rs
+++ b/src/settings.rs
@@ -1,7 +1,7 @@
//! Configure your application.
/// The settings of an application.
-#[derive(Debug, Clone, Copy, PartialEq)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct Settings {
/// The [`Window`] settings.
///
@@ -10,19 +10,13 @@ pub struct Settings {
/// [`Window`]: struct.Window.html
pub window: Window,
+ /// The bytes of the font that will be used by default.
+ ///
+ /// If `None` is provided, a default system font will be chosen.
// TODO: Add `name` for web compatibility
pub default_font: Option<&'static [u8]>,
}
-impl Default for Settings {
- fn default() -> Settings {
- Settings {
- window: Window::default(),
- default_font: None,
- }
- }
-}
-
/// The window settings of an application.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Window {
diff --git a/wgpu/src/defaults.rs b/wgpu/src/defaults.rs
index 8de8258b..11718a87 100644
--- a/wgpu/src/defaults.rs
+++ b/wgpu/src/defaults.rs
@@ -1,7 +1,10 @@
+//! Use default styling attributes to inherit styles.
use iced_native::Color;
+/// Some default styling attributes.
#[derive(Debug, Clone, Copy)]
pub struct Defaults {
+ /// Text styling
pub text: Text,
}
@@ -13,8 +16,10 @@ impl Default for Defaults {
}
}
+/// Some default text styling attributes.
#[derive(Debug, Clone, Copy)]
pub struct Text {
+ /// The default color of text
pub color: Color,
}
diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs
index dda4f322..ab14987c 100644
--- a/wgpu/src/lib.rs
+++ b/wgpu/src/lib.rs
@@ -19,7 +19,7 @@
//! [`wgpu`]: https://github.com/gfx-rs/wgpu-rs
//! [WebGPU API]: https://gpuweb.github.io/gpuweb/
//! [`wgpu_glyph`]: https://github.com/hecrj/wgpu_glyph
-//#![deny(missing_docs)]
+#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![deny(unused_results)]
#![deny(unsafe_code)]
diff --git a/wgpu/src/settings.rs b/wgpu/src/settings.rs
index c6d8369b..dbe81830 100644
--- a/wgpu/src/settings.rs
+++ b/wgpu/src/settings.rs
@@ -1,4 +1,10 @@
+/// The settings of a [`Renderer`].
+///
+/// [`Renderer`]: struct.Renderer.html
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct Settings {
+ /// The bytes of the font that will be used by default.
+ ///
+ /// If `None` is provided, a default system font will be chosen.
pub default_font: Option<&'static [u8]>,
}
diff --git a/wgpu/src/widget.rs b/wgpu/src/widget.rs
index e0f56594..e3edda0b 100644
--- a/wgpu/src/widget.rs
+++ b/wgpu/src/widget.rs
@@ -1,3 +1,12 @@
+//! Use the widgets supported out-of-the-box.
+//!
+//! # Re-exports
+//! For convenience, the contents of this module are available at the root
+//! module. Therefore, you can directly type:
+//!
+//! ```
+//! use iced_wgpu::{button, Button};
+//! ```
pub mod button;
pub mod checkbox;
pub mod container;
@@ -6,3 +15,20 @@ pub mod radio;
pub mod scrollable;
pub mod slider;
pub mod text_input;
+
+#[doc(no_inline)]
+pub use button::Button;
+#[doc(no_inline)]
+pub use checkbox::Checkbox;
+#[doc(no_inline)]
+pub use container::Container;
+#[doc(no_inline)]
+pub use progress_bar::ProgressBar;
+#[doc(no_inline)]
+pub use radio::Radio;
+#[doc(no_inline)]
+pub use scrollable::Scrollable;
+#[doc(no_inline)]
+pub use slider::Slider;
+#[doc(no_inline)]
+pub use text_input::TextInput;