Skip to content

Commit

Permalink
Fix doc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasEi committed Oct 22, 2023
1 parent f8c07bc commit 3824bc1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ Supported formats:

Enable the feature(s) for the format(s) that you want to use.

Define the types that you would like to load from files and derive `serde::Deserialize`, `bevy::reflect::TypePath`, and `bevy::reflect::TypeUuid` for them. The last derive requires a unique uuid as an attribute:
Define the types that you would like to load from files and derive `serde::Deserialize`, `bevy::reflect::TypePath`, and `bevy::asset::Asset` for them. The last derive requires a unique uuid as an attribute:
```rust
#[derive(serde::Deserialize, bevy::reflect::TypeUuid, bevy::reflect::TypePath)]
#[uuid = "413be529-bfeb-41b3-9db0-4b8b380a2c46"] // <-- keep me unique
#[derive(serde::Deserialize, bevy::asset::Asset, bevy::reflect::TypePath)]
struct Level {
positions: Vec<[f32;3]>,
}
Expand Down Expand Up @@ -57,8 +56,7 @@ fn main() {
.run();
}

#[derive(serde::Deserialize, bevy::reflect::TypeUuid, bevy::reflect::TypePath)]
#[uuid = "413be529-bfeb-41b3-9db0-4b8b380a2c46"]
#[derive(serde::Deserialize, bevy::asset::Asset, bevy::reflect::TypePath)]
struct Level {
positions: Vec<[f32; 3]>,
}
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//! The following example requires the `json` feature and loads a custom asset from a json file.
//! ```
//! use bevy::prelude::*;
//! use bevy::reflect::{TypeUuid, TypePath};
//! use bevy::reflect::TypePath;
//! # /*
//! use bevy_common_assets::json::JsonAssetPlugin;
//! # */
Expand All @@ -20,6 +20,7 @@
//! .add_plugins((DefaultPlugins, JsonAssetPlugin::<Level>::new(&["level.json"])))
//! # */
//! # .add_plugins((MinimalPlugins, AssetPlugin::default()))
//! # .init_asset::<Level>()
//! .add_systems(Startup, load_level)
//! # .add_systems(Update, stop)
//! .run()
Expand All @@ -30,8 +31,7 @@
//! commands.insert_resource(handle);
//! }
//!
//! #[derive(serde::Deserialize, TypeUuid, TypePath)]
//! #[uuid = "413be529-bfeb-41b3-9db0-4b8b380a2c46"]
//! #[derive(serde::Deserialize, Asset, TypePath)]
//! struct Level {
//! positions: Vec<[f32; 3]>,
//! }
Expand Down

0 comments on commit 3824bc1

Please sign in to comment.