summaryrefslogtreecommitdiffstats
path: root/lazy/src/lib.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-11-03 05:09:07 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-11-03 05:09:07 +0100
commit921c94162e50b09604fafeeb319c4a424d64be0e (patch)
treeeff2e63d6cbef2732bd9f29c5733181191ef0a12 /lazy/src/lib.rs
parent93e309f491a8941bafb919e75d660e65071475f4 (diff)
parent231d2fd8454eb9d24ba970131d4d7339cc0c8d51 (diff)
downloadiced-921c94162e50b09604fafeeb319c4a424d64be0e.tar.gz
iced-921c94162e50b09604fafeeb319c4a424d64be0e.tar.bz2
iced-921c94162e50b09604fafeeb319c4a424d64be0e.zip
Merge branch 'master' into fear/linear-gradients
Diffstat (limited to 'lazy/src/lib.rs')
-rw-r--r--lazy/src/lib.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/lazy/src/lib.rs b/lazy/src/lib.rs
index 3827746c..f49fe4b6 100644
--- a/lazy/src/lib.rs
+++ b/lazy/src/lib.rs
@@ -17,15 +17,30 @@
clippy::type_complexity
)]
#![cfg_attr(docsrs, feature(doc_cfg))]
+mod lazy;
+
pub mod component;
pub mod responsive;
pub use component::Component;
+pub use lazy::Lazy;
pub use responsive::Responsive;
mod cache;
use iced_native::{Element, Size};
+use std::hash::Hash;
+
+pub fn lazy<'a, Message, Renderer, Dependency, View>(
+ dependency: Dependency,
+ view: impl Fn() -> View + 'a,
+) -> Lazy<'a, Message, Renderer, Dependency, View>
+where
+ Dependency: Hash + 'a,
+ View: Into<Element<'static, Message, Renderer>>,
+{
+ Lazy::new(dependency, view)
+}
/// Turns an implementor of [`Component`] into an [`Element`] that can be
/// embedded in any application.