From 148ecd4fc05f2fbe42921eba9ceb4b3a5a4aa6ec Mon Sep 17 00:00:00 2001 From: andriyDev Date: Fri, 28 Nov 2025 11:10:29 -0800 Subject: [PATCH] Fixup imports and add necessary plugins for WebAssetPlugin doc test --- crates/bevy_asset/src/io/web.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/bevy_asset/src/io/web.rs b/crates/bevy_asset/src/io/web.rs index 196e36325c1a2..a3defa2db12d4 100644 --- a/crates/bevy_asset/src/io/web.rs +++ b/crates/bevy_asset/src/io/web.rs @@ -23,12 +23,12 @@ use tracing::warn; /// Example usage: /// /// ```rust -/// # use bevy_app::{App, Startup}; -/// # use bevy_ecs::prelude::{Commands, Res}; -/// # use bevy_asset::web::{WebAssetPlugin, AssetServer}; +/// # use bevy_app::{App, Startup, TaskPoolPlugin}; +/// # use bevy_ecs::prelude::{Commands, Component, Res}; +/// # use bevy_asset::{Asset, AssetApp, AssetPlugin, AssetServer, Handle, io::web::WebAssetPlugin}; +/// # use bevy_reflect::TypePath; /// # struct DefaultPlugins; -/// # impl DefaultPlugins { fn set(plugin: WebAssetPlugin) -> WebAssetPlugin { plugin } } -/// # use bevy_asset::web::AssetServer; +/// # impl DefaultPlugins { fn set(&self, plugin: WebAssetPlugin) -> WebAssetPlugin { plugin } } /// # #[derive(Asset, TypePath, Default)] /// # struct Image; /// # #[derive(Component)] @@ -36,6 +36,8 @@ use tracing::warn; /// # impl Sprite { fn from_image(_: Handle) -> Self { Sprite } } /// # fn main() { /// App::new() +/// # .add_plugins((TaskPoolPlugin::default(), AssetPlugin::default())) +/// # .init_asset::() /// .add_plugins(DefaultPlugins.set(WebAssetPlugin { /// silence_startup_warning: true, /// }))