summaryrefslogtreecommitdiffstats
path: root/native/src/renderer.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-11-22 19:36:57 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-11-22 19:36:57 +0100
commita7dba612f03e58d7bd9527499d893987986b347c (patch)
treeb8c3d8f997b714aa368bd6eaecf14065f7645c77 /native/src/renderer.rs
parentba56a561b254c9a5f3d23cb54d23dc311759ab4c (diff)
downloadiced-a7dba612f03e58d7bd9527499d893987986b347c.tar.gz
iced-a7dba612f03e58d7bd9527499d893987986b347c.tar.bz2
iced-a7dba612f03e58d7bd9527499d893987986b347c.zip
Write docs for `iced` and `iced_native`
Diffstat (limited to 'native/src/renderer.rs')
-rw-r--r--native/src/renderer.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/native/src/renderer.rs b/native/src/renderer.rs
index 3e19be33..7a68ada4 100644
--- a/native/src/renderer.rs
+++ b/native/src/renderer.rs
@@ -32,9 +32,21 @@ pub use windowed::{Target, Windowed};
use crate::{layout, Element};
+/// A component that can take the state of a user interface and produce an
+/// output for its users.
pub trait Renderer: Sized {
+ /// The type of output of the [`Renderer`].
+ ///
+ /// If you are implementing a graphical renderer, your output will most
+ /// likely be a tree of visual primitives.
+ ///
+ /// [`Renderer`]: trait.Renderer.html
type Output;
+ /// Lays out the elements of a user interface.
+ ///
+ /// You should override this if you need to perform any operations before or
+ /// after layouting. For instance, trimming the measurements cache.
fn layout<'a, Message>(
&mut self,
element: &Element<'a, Message, Self>,