Skip to content

Commit ad1c38a

Browse files
authored
Fix the doc test for WebAssetPlugin (#21968)
# Objective - Fix `cargo t -p bevy_asset --all-features`. - Note: `all-features` do not run on CI! - The doc tests for the `WebAssetPlugin` don't compile at all. There are bad imports and we don't even add the `AssetPlugin`. ## Solution - Add missing imports, and add missing plugins to the `App`. ## Testing - Ran `cargo t -p bevy_asset --all-features` and it passes now!
1 parent 008ca5d commit ad1c38a

File tree

1 file changed

+7
-5
lines changed
  • crates/bevy_asset/src/io

1 file changed

+7
-5
lines changed

crates/bevy_asset/src/io/web.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ use tracing::warn;
2323
/// Example usage:
2424
///
2525
/// ```rust
26-
/// # use bevy_app::{App, Startup};
27-
/// # use bevy_ecs::prelude::{Commands, Res};
28-
/// # use bevy_asset::web::{WebAssetPlugin, AssetServer};
26+
/// # use bevy_app::{App, Startup, TaskPoolPlugin};
27+
/// # use bevy_ecs::prelude::{Commands, Component, Res};
28+
/// # use bevy_asset::{Asset, AssetApp, AssetPlugin, AssetServer, Handle, io::web::WebAssetPlugin};
29+
/// # use bevy_reflect::TypePath;
2930
/// # struct DefaultPlugins;
30-
/// # impl DefaultPlugins { fn set(plugin: WebAssetPlugin) -> WebAssetPlugin { plugin } }
31-
/// # use bevy_asset::web::AssetServer;
31+
/// # impl DefaultPlugins { fn set(&self, plugin: WebAssetPlugin) -> WebAssetPlugin { plugin } }
3232
/// # #[derive(Asset, TypePath, Default)]
3333
/// # struct Image;
3434
/// # #[derive(Component)]
@@ -39,6 +39,8 @@ use tracing::warn;
3939
/// .add_plugins(DefaultPlugins.set(WebAssetPlugin {
4040
/// silence_startup_warning: true,
4141
/// }))
42+
/// # .add_plugins((TaskPoolPlugin::default(), AssetPlugin::default()))
43+
/// # .init_asset::<Image>()
4244
/// # .add_systems(Startup, setup).run();
4345
/// # }
4446
/// // ...

0 commit comments

Comments
 (0)