summaryrefslogtreecommitdiffstats
path: root/widget/src/lazy
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-05-11 15:40:57 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-05-11 15:40:57 +0200
commitb60194844a0f81a864f00e0637b6a4d131194fc5 (patch)
tree5def42ae5254560125423dd0ba2bbc5439935a2b /widget/src/lazy
parentde638f44a5c62459008a5c024b39c2443b72bf25 (diff)
downloadiced-b60194844a0f81a864f00e0637b6a4d131194fc5.tar.gz
iced-b60194844a0f81a864f00e0637b6a4d131194fc5.tar.bz2
iced-b60194844a0f81a864f00e0637b6a4d131194fc5.zip
Write missing documentation in `iced_widget`
Diffstat (limited to 'widget/src/lazy')
-rw-r--r--widget/src/lazy/helpers.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/widget/src/lazy/helpers.rs b/widget/src/lazy/helpers.rs
index be60bb78..8ca9cb86 100644
--- a/widget/src/lazy/helpers.rs
+++ b/widget/src/lazy/helpers.rs
@@ -4,6 +4,8 @@ use crate::lazy::{Lazy, Responsive};
use std::hash::Hash;
+/// Creates a new [`Lazy`] widget with the given data `Dependency` and a
+/// closure that can turn this data into a widget tree.
pub fn lazy<'a, Message, Renderer, Dependency, View>(
dependency: Dependency,
view: impl Fn(&Dependency) -> View + 'a,
@@ -29,6 +31,12 @@ where
component::view(component)
}
+/// Creates a new [`Responsive`] widget with a closure that produces its
+/// contents.
+///
+/// The `view` closure will be provided with the current [`Size`] of
+/// the [`Responsive`] widget and, therefore, can be used to build the
+/// contents of the widget in a responsive way.
pub fn responsive<'a, Message, Renderer>(
f: impl Fn(Size) -> Element<'a, Message, Renderer> + 'a,
) -> Responsive<'a, Message, Renderer>