diff options
author | 2019-08-29 01:28:00 +0200 | |
---|---|---|
committer | 2019-08-29 01:28:00 +0200 | |
commit | fafad2dfcab3b6bb11a705af61faf54e07e29773 (patch) | |
tree | 92907a5567d44dc30e09565ffb2a6c2c5337cd77 /src/renderer.rs | |
parent | 268a5f00171820ff1d3da7de03b5efab5e45c01d (diff) | |
download | iced-fafad2dfcab3b6bb11a705af61faf54e07e29773.tar.gz iced-fafad2dfcab3b6bb11a705af61faf54e07e29773.tar.bz2 iced-fafad2dfcab3b6bb11a705af61faf54e07e29773.zip |
Write `renderer` docs and fix broken links
Diffstat (limited to 'src/renderer.rs')
-rw-r--r-- | src/renderer.rs | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/renderer.rs b/src/renderer.rs index 79675793..3311f45e 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -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. |