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 {
sources: HashMap<CowArc<'static, str>, AssetSource>,
default: AssetSource,

View file

@ -167,13 +167,14 @@ pub enum ProcessError {
ExtensionRequired,
}
impl<
Loader: AssetLoader,
T: AssetTransformer<AssetInput = Loader::Asset>,
Saver: AssetSaver<Asset = T::AssetOutput>,
> Process for LoadTransformAndSave<Loader, T, Saver>
impl<Loader, Transformer, Saver> Process for LoadTransformAndSave<Loader, Transformer, Saver>
where
Loader: AssetLoader,
Transformer: AssetTransformer<AssetInput = Loader::Asset>,
Saver: AssetSaver<Asset = Transformer::AssetOutput>,
{
type Settings = LoadTransformAndSaveSettings<Loader::Settings, T::Settings, Saver::Settings>;
type Settings =
LoadTransformAndSaveSettings<Loader::Settings, Transformer::Settings, Saver::Settings>;
type OutputLoader = Saver::OutputLoader;
async fn process<'a>(
@ -200,7 +201,8 @@ impl<
.await
.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
.saver