From 18e30d3fe86daf8b304300b260e05bf70e1cde4b Mon Sep 17 00:00:00 2001 From: Alice I Cecile Date: Wed, 27 Nov 2024 15:07:46 -0500 Subject: [PATCH 1/3] Add missed migration guides --- ...tReader_read_now_returns_an_opaque_type.md | 38 +++++++++++++++++++ ...0_Deprecate_LoadAndSave_Asset_Processor.md | 2 + .../0.15/migration-guides/_guides.toml | 12 ++++++ 3 files changed, 52 insertions(+) create mode 100644 release-content/0.15/migration-guides/14082_AssetReader_read_now_returns_an_opaque_type.md create mode 100644 release-content/0.15/migration-guides/15090_Deprecate_LoadAndSave_Asset_Processor.md diff --git a/release-content/0.15/migration-guides/14082_AssetReader_read_now_returns_an_opaque_type.md b/release-content/0.15/migration-guides/14082_AssetReader_read_now_returns_an_opaque_type.md new file mode 100644 index 0000000000..2b6ede0539 --- /dev/null +++ b/release-content/0.15/migration-guides/14082_AssetReader_read_now_returns_an_opaque_type.md @@ -0,0 +1,38 @@ +The trait method `bevy_asset::io::AssetReader::read` (and `read_meta`) now return an opaque type instead of a boxed trait object. Implementors of these methods should change the type signatures appropriately + +```rust +impl AssetReader for MyReader { + // Before + async fn read<'a>(&'a self, path: &'a Path) -> Result>, AssetReaderError> { + let reader = // construct a reader + Box::new(reader) as Box> + } + + // After + async fn read<'a>(&'a self, path: &'a Path) -> Result { + // create a reader + } +} +``` + +`bevy::asset::io::Reader` is now a trait, rather than a type alias for a trait object. Implementors of `AssetLoader::load` will need to adjust the method signature accordingly + +```rust +impl AssetLoader for MyLoader { + async fn load<'a>( + &'a self, + // Before: + reader: &'a mut bevy::asset::io::Reader, + // After: + reader: &'a mut dyn bevy::asset::io::Reader, + _: &'a Self::Settings, + load_context: &'a mut LoadContext<'_>, + ) -> Result { +} +``` + +Additionally, implementors of `AssetReader` that return a type implementing `futures_io::AsyncRead` and `AsyncSeek` might need to explicitly implement `bevy::asset::io::Reader` for that type. + +```rust +impl bevy::asset::io::Reader for MyAsyncReadAndSeek {} +``` \ No newline at end of file diff --git a/release-content/0.15/migration-guides/15090_Deprecate_LoadAndSave_Asset_Processor.md b/release-content/0.15/migration-guides/15090_Deprecate_LoadAndSave_Asset_Processor.md new file mode 100644 index 0000000000..4b9e2538d9 --- /dev/null +++ b/release-content/0.15/migration-guides/15090_Deprecate_LoadAndSave_Asset_Processor.md @@ -0,0 +1,2 @@ +- Replace `LoadAndSave` with `LoadTransformAndSave::Asset>, S>` +- Replace `LoadAndSaveSettings` with `LoadTransformAndSaveSettings` diff --git a/release-content/0.15/migration-guides/_guides.toml b/release-content/0.15/migration-guides/_guides.toml index 26b33515ea..0cafff2aa6 100644 --- a/release-content/0.15/migration-guides/_guides.toml +++ b/release-content/0.15/migration-guides/_guides.toml @@ -1317,3 +1317,15 @@ title = "Remove `accesskit` re-export from `bevy_a11y`" prs = [16257] areas = [] file_name = "16257_Remove_accesskit_reexport_from_bevy_a11y.md" + +[[guides]] +title = "Deprecate `LoadAndSave` Asset Processor" +prs = [15090] +areas = ["Asset"] +file_name = "15090_Deprecate_LoadAndSave_Asset_Processor.md" + +[[guides]] +title = "`AssetReader::read` now returns an opaque type" +prs = [14082] +areas = ["Asset"] +file_name = "14082_AssetReader_read_now_returns_an_opaque_type.md" From 73bdddf63e1cb98606877563d45d4281714de38b Mon Sep 17 00:00:00 2001 From: Alice I Cecile Date: Wed, 27 Nov 2024 15:07:53 -0500 Subject: [PATCH 2/3] Add missing area tag --- release-content/0.15/migration-guides/_guides.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-content/0.15/migration-guides/_guides.toml b/release-content/0.15/migration-guides/_guides.toml index 0cafff2aa6..901ba2496a 100644 --- a/release-content/0.15/migration-guides/_guides.toml +++ b/release-content/0.15/migration-guides/_guides.toml @@ -1315,7 +1315,7 @@ file_name = "13760_Add_Display_implementation_to_DebugName.md" [[guides]] title = "Remove `accesskit` re-export from `bevy_a11y`" prs = [16257] -areas = [] +areas = ["Accessibility"] file_name = "16257_Remove_accesskit_reexport_from_bevy_a11y.md" [[guides]] From 297d90822c482a193b3cd9b5e298534334d1e40c Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Wed, 27 Nov 2024 16:20:47 -0500 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: Rich Churcher --- .../14082_AssetReader_read_now_returns_an_opaque_type.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release-content/0.15/migration-guides/14082_AssetReader_read_now_returns_an_opaque_type.md b/release-content/0.15/migration-guides/14082_AssetReader_read_now_returns_an_opaque_type.md index 2b6ede0539..7c07d63a14 100644 --- a/release-content/0.15/migration-guides/14082_AssetReader_read_now_returns_an_opaque_type.md +++ b/release-content/0.15/migration-guides/14082_AssetReader_read_now_returns_an_opaque_type.md @@ -1,4 +1,4 @@ -The trait method `bevy_asset::io::AssetReader::read` (and `read_meta`) now return an opaque type instead of a boxed trait object. Implementors of these methods should change the type signatures appropriately +The trait method `bevy_asset::io::AssetReader::read` (and `read_meta`) now return an opaque type instead of a boxed trait object. Implementors of these methods should change the type signatures appropriately: ```rust impl AssetReader for MyReader { @@ -15,7 +15,7 @@ impl AssetReader for MyReader { } ``` -`bevy::asset::io::Reader` is now a trait, rather than a type alias for a trait object. Implementors of `AssetLoader::load` will need to adjust the method signature accordingly +`bevy::asset::io::Reader` is now a trait, rather than a type alias for a trait object. Implementors of `AssetLoader::load` will need to adjust the method signature accordingly: ```rust impl AssetLoader for MyLoader {