1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use crateDependencies;
/// Declares the processed form of a source asset type.
///
/// Implement this alongside [`Asset<B>`] for every source type that is
/// uploaded to a backend. Used as the storage bound for
/// [`Assets<T>`](crate::assets::storage::Assets) — the struct that holds
/// both `T` (source) and `T::Processed` (uploaded result) per entry.
///
/// Kept separate from `Asset<B>` so that `Assets<T>` does not need to know
/// the backend type `B`.
/// Describes how a source asset of type `Self` is converted into its
/// processed form [`Self::Processed`](AssetSource::Processed), using a
/// backend `B`.
///
/// `B` is intentionally generic — it is not restricted to GPU backends:
/// - **CPU → GPU**: `B` is your graphics backend (e.g. a wgpu device).
/// - **CPU → CPU**: set `B = ()` for pure data transforms.
/// - **Audio / other**: `B` is your audio device or any other service.
///
/// # Associated types
/// - `Processed` (via [`AssetSource`]) — the result stored alongside the
/// source in [`Assets<Self>`](crate::assets::storage::Assets).
/// - `Deps` — zero or more additional resources required during the
/// conversion (see [`Dependencies`]). Use `()` when there are none.
///
/// # Upload lifecycle
/// [`AssetPlugin`](crate::assets::plugin::AssetPlugin) drains the dirty
/// queue from `Assets<Self>` each tick and calls [`upload`] for every
/// pending entry. Returning `None` re-queues the handle for the next tick,
/// allowing conversions to wait on sub-resources that may not be ready yet.