pub trait AssetLoader: Send + Sync {
// Required method
fn load(&self, name: &str) -> Result<Asset, AssetError>;
// Provided method
fn hash(&self, _name: &str) -> u128 { ... }
}Expand description
Pluggable backend for resolving named asset bindings (images,
brushes, tile features, …). Names without a scheme prefix
(<source> or <source>.<layer>) are by convention tile-scoped —
the host rebinds them per render. Asset srcs carry a scheme
(builtin:, file:, http(s)://) and are document-scoped.
hash returns a stable content/identity hash the evaluator folds
into every consuming node’s cache key, so changes in a bound asset
invalidate caches automatically. Implementations may return 0 if
the binding never changes (document-scoped, fixed disk file, etc.).
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".