Define data types for ID-based resource handling (#4168)

* Add resource lib

* rename ResourceSource to ResourceInput

* Rename ResourceInput -> DataSource and improve API

* Review

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
This commit is contained in:
Timon
2026-05-25 10:50:57 +00:00
committed by GitHub
co-authored by Dennis Kobert
parent d0d9a350c7
commit bbbe04903f
28 changed files with 187 additions and 46 deletions
@@ -9,9 +9,10 @@ use std::time::Duration;
use text_nodes::FontCache;
use vector_types::vector::style::RenderMode;
pub mod resource;
pub use core_types::resource::Resource;
pub use resource::{LoadResource, ResourceFuture, ResourceHash, ResourceStorage};
pub mod resource {
pub use core_types::resource::*;
pub use graphene_resource::*;
}
#[cfg(feature = "wgpu")]
#[derive(Debug, Clone, Hash, PartialEq, Eq, DynAny)]
@@ -49,7 +50,7 @@ pub trait ApplicationIo {
fn gpu_executor(&self) -> Option<&Self::Executor> {
None
}
fn load_resource(&self, hash: ResourceHash) -> resource::ResourceFuture;
fn load_resource(&self, hash: resource::ResourceHash) -> resource::ResourceFuture;
}
impl<T: ApplicationIo> ApplicationIo for &T {
@@ -59,7 +60,7 @@ impl<T: ApplicationIo> ApplicationIo for &T {
(**self).gpu_executor()
}
fn load_resource(&self, hash: ResourceHash) -> resource::ResourceFuture {
fn load_resource(&self, hash: resource::ResourceHash) -> resource::ResourceFuture {
(**self).load_resource(hash)
}
}