Skip to content

Commit

Permalink
Write missing docs in iced_graphics and iced_wgpu
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Jun 29, 2023
1 parent fa5650c commit 6921564
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions graphics/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use std::borrow::Cow;
///
/// [`Renderer`]: crate::Renderer
pub trait Backend {
/// The custom kind of primitives this [`Backend`] supports.
type Primitive;
}

Expand Down
1 change: 1 addition & 0 deletions graphics/src/damage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions graphics/src/geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`].
Expand Down
6 changes: 3 additions & 3 deletions graphics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -23,6 +23,7 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
mod antialiasing;
mod error;
mod primitive;
mod transformation;
mod viewport;

Expand All @@ -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")]
Expand Down
1 change: 1 addition & 0 deletions graphics/src/mesh.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! Draw triangles!
use crate::color;
use crate::core::{Rectangle, Size};
use crate::gradient;
Expand Down
4 changes: 4 additions & 0 deletions graphics/src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>>,
Expand All @@ -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>>,
Expand Down
4 changes: 2 additions & 2 deletions wgpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions wgpu/src/primitive.rs
Original file line number Diff line number Diff line change
@@ -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),
}

Expand Down

0 comments on commit 6921564

Please sign in to comment.