mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-24 15:48:11 +08:00
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:
@@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user