From 5198f8e3e44ef512295db1394d377b75bafe7e3c Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sat, 4 Apr 2020 02:14:02 +0100 Subject: [PATCH 1/4] document wgpu feature flags --- wgpu/src/lib.rs | 2 ++ wgpu/src/widget.rs | 1 + wgpu/src/widget/canvas/frame.rs | 1 + 3 files changed, 4 insertions(+) diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index f00c7d2c..799c1f34 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -25,6 +25,8 @@ #![deny(unused_results)] #![forbid(unsafe_code)] #![forbid(rust_2018_idioms)] +#![cfg_attr(docsrs, feature(doc_cfg))] + pub mod defaults; pub mod settings; pub mod triangle; diff --git a/wgpu/src/widget.rs b/wgpu/src/widget.rs index b39f2d91..c3a47dff 100644 --- a/wgpu/src/widget.rs +++ b/wgpu/src/widget.rs @@ -37,6 +37,7 @@ pub use slider::Slider; pub use text_input::TextInput; #[cfg(feature = "canvas")] +#[cfg_attr(docsrs, doc(cfg(feature = "canvas")))] pub mod canvas; #[cfg(feature = "canvas")] diff --git a/wgpu/src/widget/canvas/frame.rs b/wgpu/src/widget/canvas/frame.rs index 7d7ce06a..df1d7df5 100644 --- a/wgpu/src/widget/canvas/frame.rs +++ b/wgpu/src/widget/canvas/frame.rs @@ -172,6 +172,7 @@ impl Frame { /// /// [`Text`]: struct.Text.html /// [`Frame`]: struct.Frame.html + /// [`Canvas`]: struct.Canvas.html pub fn fill_text(&mut self, text: Text) { use std::f32; From 070e8e70e4a99906225f64f2ae26d06da9e36dca Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sat, 4 Apr 2020 02:25:40 +0100 Subject: [PATCH 2/4] doc feature flags in futures --- futures/src/executor/async_std.rs | 1 + futures/src/executor/thread_pool.rs | 1 + futures/src/executor/tokio.rs | 1 + futures/src/lib.rs | 2 ++ 4 files changed, 5 insertions(+) diff --git a/futures/src/executor/async_std.rs b/futures/src/executor/async_std.rs index 27949e31..471be369 100644 --- a/futures/src/executor/async_std.rs +++ b/futures/src/executor/async_std.rs @@ -3,6 +3,7 @@ use crate::Executor; use futures::Future; /// An `async-std` runtime. +#[cfg_attr(docsrs, doc(cfg(feature = "async-std")))] #[derive(Debug)] pub struct AsyncStd; diff --git a/futures/src/executor/thread_pool.rs b/futures/src/executor/thread_pool.rs index 1ec5bf69..a6c6168e 100644 --- a/futures/src/executor/thread_pool.rs +++ b/futures/src/executor/thread_pool.rs @@ -3,6 +3,7 @@ use crate::Executor; use futures::Future; /// A thread pool runtime for futures. +#[cfg_attr(docsrs, doc(cfg(feature = "thread-pool")))] pub type ThreadPool = futures::executor::ThreadPool; impl Executor for futures::executor::ThreadPool { diff --git a/futures/src/executor/tokio.rs b/futures/src/executor/tokio.rs index 20802ceb..a730bce8 100644 --- a/futures/src/executor/tokio.rs +++ b/futures/src/executor/tokio.rs @@ -3,6 +3,7 @@ use crate::Executor; use futures::Future; /// A `tokio` runtime. +#[cfg_attr(docsrs, doc(cfg(feature = "tokio")))] pub type Tokio = tokio::runtime::Runtime; impl Executor for Tokio { diff --git a/futures/src/lib.rs b/futures/src/lib.rs index 79178931..966a9cdc 100644 --- a/futures/src/lib.rs +++ b/futures/src/lib.rs @@ -4,6 +4,8 @@ #![deny(unused_results)] #![forbid(unsafe_code)] #![forbid(rust_2018_idioms)] +#![cfg_attr(docsrs, feature(doc_cfg))] + pub use futures; mod command; From 7479ba137f75a7d3116a4cf244c499d05df4aff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Sun, 5 Apr 2020 04:38:10 +0200 Subject: [PATCH 3/4] Document widget feature flags --- src/lib.rs | 1 + src/widget.rs | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index e6e15e95..4f66cc73 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -178,6 +178,7 @@ #![deny(unused_results)] #![forbid(unsafe_code)] #![forbid(rust_2018_idioms)] +#![cfg_attr(docsrs, feature(doc_cfg))] mod application; mod element; mod sandbox; diff --git a/src/widget.rs b/src/widget.rs index 758dc930..03e3192b 100644 --- a/src/widget.rs +++ b/src/widget.rs @@ -18,13 +18,22 @@ //! [`text_input::State`]: text_input/struct.State.html #[cfg(not(target_arch = "wasm32"))] mod platform { - pub use iced_wgpu::widget::*; + pub use iced_wgpu::widget::{ + button, checkbox, container, pane_grid, progress_bar, radio, + scrollable, slider, text_input, + }; + #[cfg(feature = "canvas")] + #[cfg_attr(docsrs, doc(cfg(feature = "canvas")))] + pub use iced_wgpu::widget::canvas; + + #[cfg_attr(docsrs, doc(cfg(feature = "image")))] pub mod image { //! Display images in your user interface. pub use iced_winit::image::{Handle, Image}; } + #[cfg_attr(docsrs, doc(cfg(feature = "svg")))] pub mod svg { //! Display vector graphics in your user interface. pub use iced_winit::svg::{Handle, Svg}; From 335ad1dd1d5bfa65e9a3174fcecd9e1fe871646d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Sun, 5 Apr 2020 04:52:03 +0200 Subject: [PATCH 4/4] Enable feature flags in `docs.rs` --- Cargo.toml | 4 ++++ futures/Cargo.toml | 4 ++++ wgpu/Cargo.toml | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 286d49b5..c9e19653 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -65,3 +65,7 @@ iced_wgpu = { version = "0.2", path = "wgpu" } [target.'cfg(target_arch = "wasm32")'.dependencies] iced_web = { version = "0.2", path = "web" } + +[package.metadata.docs.rs] +rustdoc-args = ["--cfg", "docsrs"] +features = ["image", "svg", "canvas"] diff --git a/futures/Cargo.toml b/futures/Cargo.toml index 869a30ba..3fe8719b 100644 --- a/futures/Cargo.toml +++ b/futures/Cargo.toml @@ -30,3 +30,7 @@ optional = true [target.'cfg(target_arch = "wasm32")'.dependencies] wasm-bindgen-futures = "0.4" + +[package.metadata.docs.rs] +rustdoc-args = ["--cfg", "docsrs"] +all-features = true diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index ca906894..d6659dd3 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -41,3 +41,7 @@ optional = true [dependencies.lyon] version = "0.15" optional = true + +[package.metadata.docs.rs] +rustdoc-args = ["--cfg", "docsrs"] +all-features = true