aboutsummaryrefslogtreecommitdiff
path: root/mingling_core/src/asset
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-05-07 13:24:15 +0800
committer魏曹先生 <1992414357@qq.com>2026-05-07 13:24:15 +0800
commit13a1723050f1d92d33cfff1040be12f39f189c9e (patch)
tree19de09b5f44be6bc990f0f8e1b5d7b077684ea84 /mingling_core/src/asset
parent11f32d55a79853ae764d2cf7c07e7174ccb0c239 (diff)
Add support for resource injection in `#[chain]` macro
Diffstat (limited to 'mingling_core/src/asset')
-rw-r--r--mingling_core/src/asset/global_resource.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/mingling_core/src/asset/global_resource.rs b/mingling_core/src/asset/global_resource.rs
index efe4165..29d2405 100644
--- a/mingling_core/src/asset/global_resource.rs
+++ b/mingling_core/src/asset/global_resource.rs
@@ -99,6 +99,12 @@ impl<ResType: 'static + Send + Sync> std::ops::Deref for GlobalResource<ResType>
}
}
+impl<ResType: 'static + Send + Sync> AsRef<ResType> for GlobalResource<ResType> {
+ fn as_ref(&self) -> &ResType {
+ &self.res_arc
+ }
+}
+
/// Resource marker trait, types that implement the Clone and Default traits can be considered as resources
pub trait ResourceMarker {
fn res_clone(&self) -> Self;