diff options
author | 2023-06-29 07:55:52 +0200 | |
---|---|---|
committer | 2023-06-29 07:55:52 +0200 | |
commit | 6921564c9f66e8103e19ec658099c5f5c32e8cc5 (patch) | |
tree | ed833fab41f64c57a7522fea400ea42eec788e9f | |
parent | fa5650cfd1115e6ccec2ad795cf58fd970d5b43c (diff) | |
download | iced-6921564c9f66e8103e19ec658099c5f5c32e8cc5.tar.gz iced-6921564c9f66e8103e19ec658099c5f5c32e8cc5.tar.bz2 iced-6921564c9f66e8103e19ec658099c5f5c32e8cc5.zip |
Write missing docs in `iced_graphics` and `iced_wgpu`
-rw-r--r-- | graphics/src/backend.rs | 1 | ||||
-rw-r--r-- | graphics/src/damage.rs | 1 | ||||
-rw-r--r-- | graphics/src/geometry.rs | 1 | ||||
-rw-r--r-- | graphics/src/lib.rs | 6 | ||||
-rw-r--r-- | graphics/src/mesh.rs | 1 | ||||
-rw-r--r-- | graphics/src/renderer.rs | 4 | ||||
-rw-r--r-- | wgpu/src/lib.rs | 4 | ||||
-rw-r--r-- | wgpu/src/primitive.rs | 4 |
8 files changed, 17 insertions, 5 deletions
diff --git a/graphics/src/backend.rs b/graphics/src/backend.rs index 3ff24335..77bb650b 100644 --- a/graphics/src/backend.rs +++ b/graphics/src/backend.rs @@ -10,6 +10,7 @@ use std::borrow::Cow; /// /// [`Renderer`]: crate::Renderer pub trait Backend { + /// The custom kind of primitives this [`Backend`] supports. type Primitive; } diff --git a/graphics/src/damage.rs b/graphics/src/damage.rs index be17b935..2f29956e 100644 --- a/graphics/src/damage.rs +++ b/graphics/src/damage.rs @@ -5,6 +5,7 @@ use crate::Primitive; use std::sync::Arc; +/// A type that has some damage bounds. pub trait Damage: PartialEq { /// Returns the bounds of the [`Damage`]. fn bounds(&self) -> Rectangle; diff --git a/graphics/src/geometry.rs b/graphics/src/geometry.rs index 5e547bae..7cd3dd3a 100644 --- a/graphics/src/geometry.rs +++ b/graphics/src/geometry.rs @@ -16,6 +16,7 @@ pub use crate::gradient::{self, Gradient}; /// A renderer capable of drawing some [`Geometry`]. pub trait Renderer: crate::core::Renderer { + /// The kind of geometry this renderer can draw. type Geometry; /// Draws the given layers of [`Geometry`]. diff --git a/graphics/src/lib.rs b/graphics/src/lib.rs index cef36003..af374a2f 100644 --- a/graphics/src/lib.rs +++ b/graphics/src/lib.rs @@ -8,8 +8,8 @@ html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg" )] #![deny( - //missing_debug_implementations, - //missing_docs, + missing_debug_implementations, + missing_docs, unsafe_code, unused_results, clippy::extra_unused_lifetimes, @@ -23,6 +23,7 @@ #![cfg_attr(docsrs, feature(doc_auto_cfg))] mod antialiasing; mod error; +mod primitive; mod transformation; mod viewport; @@ -32,7 +33,6 @@ pub mod compositor; pub mod damage; pub mod gradient; pub mod mesh; -pub mod primitive; pub mod renderer; #[cfg(feature = "geometry")] diff --git a/graphics/src/mesh.rs b/graphics/src/mesh.rs index 6ca7f79f..cfb5a60f 100644 --- a/graphics/src/mesh.rs +++ b/graphics/src/mesh.rs @@ -1,3 +1,4 @@ +//! Draw triangles! use crate::color; use crate::core::{Rectangle, Size}; use crate::gradient; diff --git a/graphics/src/renderer.rs b/graphics/src/renderer.rs index 459faf40..d80dea34 100644 --- a/graphics/src/renderer.rs +++ b/graphics/src/renderer.rs @@ -48,10 +48,12 @@ impl<B: Backend, T> Renderer<B, T> { f(&mut self.backend, &self.primitives) } + /// Starts recording a new layer. pub fn start_layer(&mut self) -> Vec<Primitive<B::Primitive>> { std::mem::take(&mut self.primitives) } + /// Ends the recording of a layer. pub fn end_layer( &mut self, primitives: Vec<Primitive<B::Primitive>>, @@ -62,10 +64,12 @@ impl<B: Backend, T> Renderer<B, T> { self.primitives.push(Primitive::group(layer).clip(bounds)); } + /// Starts recording a translation. pub fn start_translation(&mut self) -> Vec<Primitive<B::Primitive>> { std::mem::take(&mut self.primitives) } + /// Ends the recording of a translation. pub fn end_translation( &mut self, primitives: Vec<Primitive<B::Primitive>>, diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 0ffaeeef..deb223ef 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -24,8 +24,8 @@ html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg" )] #![deny( - //missing_debug_implementations, - //missing_docs, + missing_debug_implementations, + missing_docs, unsafe_code, unused_results, clippy::extra_unused_lifetimes, diff --git a/wgpu/src/primitive.rs b/wgpu/src/primitive.rs index a8f1119c..8dbf3008 100644 --- a/wgpu/src/primitive.rs +++ b/wgpu/src/primitive.rs @@ -1,10 +1,14 @@ +//! Draw using different graphical primitives. use crate::core::Rectangle; use crate::graphics::{Damage, Mesh}; +/// The graphical primitives supported by `iced_wgpu`. pub type Primitive = crate::graphics::Primitive<Custom>; +/// The custom primitives supported by `iced_wgpu`. #[derive(Debug, Clone, PartialEq)] pub enum Custom { + /// A mesh primitive. Mesh(Mesh), } |