Write renderer docs and fix broken links
This commit is contained in:
parent
268a5f0017
commit
fafad2dfca
12 changed files with 62 additions and 45 deletions
|
|
@ -1,6 +1,33 @@
|
|||
//! Write your own renderer!
|
||||
//!
|
||||
//! There is not a common entrypoint or trait for a __renderer__ in Iced.
|
||||
//! Instead, every [`Widget`] constrains its generic `Renderer` type as
|
||||
//! necessary.
|
||||
//!
|
||||
//! This approach is flexible and composable. For instance, the
|
||||
//! [`Text`] widget only needs a [`text::Renderer`] while a [`Checkbox`] widget
|
||||
//! needs both a [`text::Renderer`] and a [`checkbox::Renderer`], reusing logic.
|
||||
//!
|
||||
//! In the end, a __renderer__ satisfying all the constraints is
|
||||
//! needed to build a [`UserInterface`].
|
||||
//!
|
||||
//! [`Widget`]: ../widget/trait.Widget.html
|
||||
//! [`UserInterface`]: ../struct.UserInterface.html
|
||||
//! [`Text`]: ../widget/text/struct.Text.html
|
||||
//! [`text::Renderer`]: ../widget/text/trait.Renderer.html
|
||||
//! [`Checkbox`]: ../widget/checkbox/struct.Checkbox.html
|
||||
//! [`checkbox::Renderer`]: ../widget/checkbox/trait.Renderer.html
|
||||
use crate::Layout;
|
||||
|
||||
pub trait Renderer {
|
||||
/// A renderer able to graphically explain a [`Layout`].
|
||||
///
|
||||
/// [`Layout`]: ../struct.Layout.html
|
||||
pub trait Debugger {
|
||||
/// The color type that will be used to configure the _explanation_.
|
||||
///
|
||||
/// This is the type that will be asked in [`Element::explain`].
|
||||
///
|
||||
/// [`Element::explain`]: ../struct.Element.html#method.explain
|
||||
type Color: Copy;
|
||||
|
||||
/// Explains the [`Layout`] of an [`Element`] for debugging purposes.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue