Make ResourceStorage trait &self-based and remove 'static requirement (#4188)

* Make ResourceStorage trait &self-based with elided-lifetime ResourceFuture

* Adress review comments
This commit is contained in:
Dennis Kobert
2026-06-01 10:37:05 +00:00
committed by GitHub
parent e32ff4b7f0
commit 7b9c480a8d
12 changed files with 52 additions and 48 deletions
+8 -2
View File
@@ -60,8 +60,14 @@ impl ApplicationIo for PlatformApplicationIo {
self.gpu_executor.as_ref()
}
fn load_resource(&self, hash: resource::ResourceHash) -> resource::ResourceFuture {
self.resources.as_ref().expect("Resource storage not initialized").load(hash)
fn load_resource(&self, hash: resource::ResourceHash) -> resource::ResourceFuture<'_> {
match self.resources.as_ref() {
Some(resources) => resources.load(hash),
None => {
log::error!("load_resource called before resource storage was initialized");
Box::pin(std::future::ready(None))
}
}
}
}