Write missing docs in iced_graphics and iced_wgpu

This commit is contained in:
Héctor Ramón Jiménez 2023-06-29 07:55:52 +02:00
parent fa5650cfd1
commit 6921564c9f
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
8 changed files with 17 additions and 5 deletions

View file

@ -10,6 +10,7 @@ use std::borrow::Cow;
///
/// [`Renderer`]: crate::Renderer
pub trait Backend {
/// The custom kind of primitives this [`Backend`] supports.
type Primitive;
}

View file

@ -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;

View file

@ -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`].

View file

@ -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")]

View file

@ -1,3 +1,4 @@
//! Draw triangles!
use crate::color;
use crate::core::{Rectangle, Size};
use crate::gradient;

View file

@ -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>>,

View file

@ -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,

View file

@ -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),
}