summaryrefslogtreecommitdiffstats
path: root/graphics/src/cached.rs
diff options
context:
space:
mode:
authorLibravatar Gigas002 <24297712+Gigas002@users.noreply.github.com>2024-04-16 00:08:17 +0900
committerLibravatar GitHub <noreply@github.com>2024-04-16 00:08:17 +0900
commit0ebe0629cef37aee5c48b9409fc36618a3a3e60d (patch)
tree909d9ecf28e7c491bae3afc81928c118517fa7a9 /graphics/src/cached.rs
parent13bd106fc585034a7aba17b9c17589113274aaf5 (diff)
parent105b8bd5ad6ade1f203a0d8b0b93bd06f61f621a (diff)
downloadiced-0ebe0629cef37aee5c48b9409fc36618a3a3e60d.tar.gz
iced-0ebe0629cef37aee5c48b9409fc36618a3a3e60d.tar.bz2
iced-0ebe0629cef37aee5c48b9409fc36618a3a3e60d.zip
Merge branch 'iced-rs:master' into viewer_content_fit
Diffstat (limited to 'graphics/src/cached.rs')
-rw-r--r--graphics/src/cached.rs24
1 files changed, 3 insertions, 21 deletions
diff --git a/graphics/src/cached.rs b/graphics/src/cached.rs
index b52f9d9d..c0e4e029 100644
--- a/graphics/src/cached.rs
+++ b/graphics/src/cached.rs
@@ -1,11 +1,7 @@
-use crate::Primitive;
-
-use std::sync::Arc;
-
/// A piece of data that can be cached.
pub trait Cached: Sized {
/// The type of cache produced.
- type Cache;
+ type Cache: Clone;
/// Loads the [`Cache`] into a proper instance.
///
@@ -15,21 +11,7 @@ pub trait Cached: Sized {
/// Caches this value, producing its corresponding [`Cache`].
///
/// [`Cache`]: Self::Cache
- fn cache(self) -> Self::Cache;
-}
-
-impl<T> Cached for Primitive<T> {
- type Cache = Arc<Self>;
-
- fn load(cache: &Arc<Self>) -> Self {
- Self::Cache {
- content: cache.clone(),
- }
- }
-
- fn cache(self) -> Arc<Self> {
- Arc::new(self)
- }
+ fn cache(self, previous: Option<Self::Cache>) -> Self::Cache;
}
#[cfg(debug_assertions)]
@@ -38,5 +20,5 @@ impl Cached for () {
fn load(_cache: &Self::Cache) -> Self {}
- fn cache(self) -> Self::Cache {}
+ fn cache(self, _previous: Option<Self::Cache>) -> Self::Cache {}
}