Misc asset code quality and docs (#13382)

* Fix a doc comment for AssetSources
* Move some complicated generics to a where clause and write out T ->
Transformer fully
This commit is contained in:
JMS55 2024-05-15 11:49:04 -07:00 committed by GitHub
parent f91fd322b7
commit debcf3fb1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 8 deletions

View File

@ -525,7 +525,7 @@ impl AssetSource {
} }
} }
/// A collection of [`AssetSources`]. /// A collection of [`AssetSource`]s.
pub struct AssetSources { pub struct AssetSources {
sources: HashMap<CowArc<'static, str>, AssetSource>, sources: HashMap<CowArc<'static, str>, AssetSource>,
default: AssetSource, default: AssetSource,

View File

@ -167,13 +167,14 @@ pub enum ProcessError {
ExtensionRequired, ExtensionRequired,
} }
impl< impl<Loader, Transformer, Saver> Process for LoadTransformAndSave<Loader, Transformer, Saver>
where
Loader: AssetLoader, Loader: AssetLoader,
T: AssetTransformer<AssetInput = Loader::Asset>, Transformer: AssetTransformer<AssetInput = Loader::Asset>,
Saver: AssetSaver<Asset = T::AssetOutput>, Saver: AssetSaver<Asset = Transformer::AssetOutput>,
> Process for LoadTransformAndSave<Loader, T, Saver>
{ {
type Settings = LoadTransformAndSaveSettings<Loader::Settings, T::Settings, Saver::Settings>; type Settings =
LoadTransformAndSaveSettings<Loader::Settings, Transformer::Settings, Saver::Settings>;
type OutputLoader = Saver::OutputLoader; type OutputLoader = Saver::OutputLoader;
async fn process<'a>( async fn process<'a>(
@ -200,7 +201,8 @@ impl<
.await .await
.map_err(|err| ProcessError::AssetTransformError(err.into()))?; .map_err(|err| ProcessError::AssetTransformError(err.into()))?;
let saved_asset = SavedAsset::<T::AssetOutput>::from_transformed(&post_transformed_asset); let saved_asset =
SavedAsset::<Transformer::AssetOutput>::from_transformed(&post_transformed_asset);
let output_settings = self let output_settings = self
.saver .saver