Rename iced_lazy::Cached to Lazy 🎉

This commit is contained in:
Héctor Ramón Jiménez 2022-11-03 02:46:31 +01:00
parent adf541d432
commit 1cdc1fcd06
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
3 changed files with 50 additions and 40 deletions

View file

@ -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.