diff options
author | 2020-02-09 03:44:16 +0100 | |
---|---|---|
committer | 2020-02-09 03:44:16 +0100 | |
commit | 9a73c3a88d92262b4e59c1f061b1c56e533e2b0b (patch) | |
tree | 05014ecebcbd31c043f2e168de4830a96fa3cc32 | |
parent | 8f0b59a4b28bee028a879b0705eeeaa0b2e82df6 (diff) | |
download | iced-9a73c3a88d92262b4e59c1f061b1c56e533e2b0b.tar.gz iced-9a73c3a88d92262b4e59c1f061b1c56e533e2b0b.tar.bz2 iced-9a73c3a88d92262b4e59c1f061b1c56e533e2b0b.zip |
Write documentation for new `iced_wgpu` types
-rw-r--r-- | wgpu/src/lib.rs | 2 | ||||
-rw-r--r-- | wgpu/src/target.rs | 6 | ||||
-rw-r--r-- | wgpu/src/window.rs | 1 | ||||
-rw-r--r-- | wgpu/src/window/backend.rs | 1 | ||||
-rw-r--r-- | wgpu/src/window/swap_chain.rs | 7 |
5 files changed, 16 insertions, 1 deletions
diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 9c1739b2..b38da060 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)] #![forbid(unsafe_code)] diff --git a/wgpu/src/target.rs b/wgpu/src/target.rs index 544e83d1..1e72c0c3 100644 --- a/wgpu/src/target.rs +++ b/wgpu/src/target.rs @@ -3,6 +3,12 @@ use crate::Viewport; /// A rendering target. #[derive(Debug)] pub struct Target<'a> { + /// The texture where graphics will be rendered. pub texture: &'a wgpu::TextureView, + + /// The viewport of the target. + /// + /// Most of the time, you will want this to match the dimensions of the + /// texture. pub viewport: &'a Viewport, } diff --git a/wgpu/src/window.rs b/wgpu/src/window.rs index 97cac9b7..b7adad82 100644 --- a/wgpu/src/window.rs +++ b/wgpu/src/window.rs @@ -1,3 +1,4 @@ +//! Display rendering results on windows. mod backend; mod swap_chain; diff --git a/wgpu/src/window/backend.rs b/wgpu/src/window/backend.rs index 0e4f02c9..87779bea 100644 --- a/wgpu/src/window/backend.rs +++ b/wgpu/src/window/backend.rs @@ -3,6 +3,7 @@ use crate::{window::SwapChain, Renderer, Settings, Target}; use iced_native::MouseCursor; use raw_window_handle::HasRawWindowHandle; +/// A window graphics backend for iced powered by `wgpu`. #[derive(Debug)] pub struct Backend { device: wgpu::Device, diff --git a/wgpu/src/window/swap_chain.rs b/wgpu/src/window/swap_chain.rs index 3760e8a2..6f545fce 100644 --- a/wgpu/src/window/swap_chain.rs +++ b/wgpu/src/window/swap_chain.rs @@ -12,6 +12,9 @@ pub struct SwapChain { impl SwapChain {} impl SwapChain { + /// Creates a new [`SwapChain`] for the given surface. + /// + /// [`SwapChain`]: struct.SwapChain.html pub fn new( device: &wgpu::Device, surface: &wgpu::Surface, @@ -24,6 +27,10 @@ impl SwapChain { } } + /// Returns the next frame of the [`SwapChain`] alongside its [`Viewport`]. + /// + /// [`SwapChain`]: struct.SwapChain.html + /// [`Viewport`]: ../struct.Viewport.html pub fn next_frame(&mut self) -> (wgpu::SwapChainOutput<'_>, &Viewport) { (self.raw.get_next_texture(), &self.viewport) } |