diff options
author | 2022-11-03 02:46:31 +0100 | |
---|---|---|
committer | 2022-11-03 02:46:31 +0100 | |
commit | 1cdc1fcd0669bfea096237c07b32742c1a3f2158 (patch) | |
tree | c636951447fa1ccefdc4fb4a6c8f58240710da4c /lazy/src/lib.rs | |
parent | adf541d4325df22d577342f870f0f95fa357797a (diff) | |
download | iced-1cdc1fcd0669bfea096237c07b32742c1a3f2158.tar.gz iced-1cdc1fcd0669bfea096237c07b32742c1a3f2158.tar.bz2 iced-1cdc1fcd0669bfea096237c07b32742c1a3f2158.zip |
Rename `iced_lazy::Cached` to `Lazy` :tada:
Diffstat (limited to '')
-rw-r--r-- | lazy/src/lib.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lazy/src/lib.rs b/lazy/src/lib.rs index c01b439b..f49fe4b6 100644 --- a/lazy/src/lib.rs +++ b/lazy/src/lib.rs @@ -17,17 +17,30 @@ clippy::type_complexity )] #![cfg_attr(docsrs, feature(doc_cfg))] -pub mod cached; +mod lazy; + pub mod component; pub mod responsive; -pub use cached::Cached; 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. |