Write missing docs in iced_graphics and iced_wgpu
This commit is contained in:
parent
fa5650cfd1
commit
6921564c9f
8 changed files with 17 additions and 5 deletions
|
|
@ -10,6 +10,7 @@ use std::borrow::Cow;
|
||||||
///
|
///
|
||||||
/// [`Renderer`]: crate::Renderer
|
/// [`Renderer`]: crate::Renderer
|
||||||
pub trait Backend {
|
pub trait Backend {
|
||||||
|
/// The custom kind of primitives this [`Backend`] supports.
|
||||||
type Primitive;
|
type Primitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ use crate::Primitive;
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
/// A type that has some damage bounds.
|
||||||
pub trait Damage: PartialEq {
|
pub trait Damage: PartialEq {
|
||||||
/// Returns the bounds of the [`Damage`].
|
/// Returns the bounds of the [`Damage`].
|
||||||
fn bounds(&self) -> Rectangle;
|
fn bounds(&self) -> Rectangle;
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ pub use crate::gradient::{self, Gradient};
|
||||||
|
|
||||||
/// A renderer capable of drawing some [`Geometry`].
|
/// A renderer capable of drawing some [`Geometry`].
|
||||||
pub trait Renderer: crate::core::Renderer {
|
pub trait Renderer: crate::core::Renderer {
|
||||||
|
/// The kind of geometry this renderer can draw.
|
||||||
type Geometry;
|
type Geometry;
|
||||||
|
|
||||||
/// Draws the given layers of [`Geometry`].
|
/// Draws the given layers of [`Geometry`].
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@
|
||||||
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
|
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
|
||||||
)]
|
)]
|
||||||
#![deny(
|
#![deny(
|
||||||
//missing_debug_implementations,
|
missing_debug_implementations,
|
||||||
//missing_docs,
|
missing_docs,
|
||||||
unsafe_code,
|
unsafe_code,
|
||||||
unused_results,
|
unused_results,
|
||||||
clippy::extra_unused_lifetimes,
|
clippy::extra_unused_lifetimes,
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||||
mod antialiasing;
|
mod antialiasing;
|
||||||
mod error;
|
mod error;
|
||||||
|
mod primitive;
|
||||||
mod transformation;
|
mod transformation;
|
||||||
mod viewport;
|
mod viewport;
|
||||||
|
|
||||||
|
|
@ -32,7 +33,6 @@ pub mod compositor;
|
||||||
pub mod damage;
|
pub mod damage;
|
||||||
pub mod gradient;
|
pub mod gradient;
|
||||||
pub mod mesh;
|
pub mod mesh;
|
||||||
pub mod primitive;
|
|
||||||
pub mod renderer;
|
pub mod renderer;
|
||||||
|
|
||||||
#[cfg(feature = "geometry")]
|
#[cfg(feature = "geometry")]
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
//! Draw triangles!
|
||||||
use crate::color;
|
use crate::color;
|
||||||
use crate::core::{Rectangle, Size};
|
use crate::core::{Rectangle, Size};
|
||||||
use crate::gradient;
|
use crate::gradient;
|
||||||
|
|
|
||||||
|
|
@ -48,10 +48,12 @@ impl<B: Backend, T> Renderer<B, T> {
|
||||||
f(&mut self.backend, &self.primitives)
|
f(&mut self.backend, &self.primitives)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Starts recording a new layer.
|
||||||
pub fn start_layer(&mut self) -> Vec<Primitive<B::Primitive>> {
|
pub fn start_layer(&mut self) -> Vec<Primitive<B::Primitive>> {
|
||||||
std::mem::take(&mut self.primitives)
|
std::mem::take(&mut self.primitives)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Ends the recording of a layer.
|
||||||
pub fn end_layer(
|
pub fn end_layer(
|
||||||
&mut self,
|
&mut self,
|
||||||
primitives: Vec<Primitive<B::Primitive>>,
|
primitives: Vec<Primitive<B::Primitive>>,
|
||||||
|
|
@ -62,10 +64,12 @@ impl<B: Backend, T> Renderer<B, T> {
|
||||||
self.primitives.push(Primitive::group(layer).clip(bounds));
|
self.primitives.push(Primitive::group(layer).clip(bounds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Starts recording a translation.
|
||||||
pub fn start_translation(&mut self) -> Vec<Primitive<B::Primitive>> {
|
pub fn start_translation(&mut self) -> Vec<Primitive<B::Primitive>> {
|
||||||
std::mem::take(&mut self.primitives)
|
std::mem::take(&mut self.primitives)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Ends the recording of a translation.
|
||||||
pub fn end_translation(
|
pub fn end_translation(
|
||||||
&mut self,
|
&mut self,
|
||||||
primitives: Vec<Primitive<B::Primitive>>,
|
primitives: Vec<Primitive<B::Primitive>>,
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@
|
||||||
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
|
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
|
||||||
)]
|
)]
|
||||||
#![deny(
|
#![deny(
|
||||||
//missing_debug_implementations,
|
missing_debug_implementations,
|
||||||
//missing_docs,
|
missing_docs,
|
||||||
unsafe_code,
|
unsafe_code,
|
||||||
unused_results,
|
unused_results,
|
||||||
clippy::extra_unused_lifetimes,
|
clippy::extra_unused_lifetimes,
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,14 @@
|
||||||
|
//! Draw using different graphical primitives.
|
||||||
use crate::core::Rectangle;
|
use crate::core::Rectangle;
|
||||||
use crate::graphics::{Damage, Mesh};
|
use crate::graphics::{Damage, Mesh};
|
||||||
|
|
||||||
|
/// The graphical primitives supported by `iced_wgpu`.
|
||||||
pub type Primitive = crate::graphics::Primitive<Custom>;
|
pub type Primitive = crate::graphics::Primitive<Custom>;
|
||||||
|
|
||||||
|
/// The custom primitives supported by `iced_wgpu`.
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub enum Custom {
|
pub enum Custom {
|
||||||
|
/// A mesh primitive.
|
||||||
Mesh(Mesh),
|
Mesh(Mesh),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue