Skip to content

Commit 446d3db

Browse files
Remove Rust doc shortcodes from new book (#272)
1 parent 579edc7 commit 446d3db

File tree

11 files changed

+290
-174
lines changed

11 files changed

+290
-174
lines changed

content/learn/book/migration-guides/0.4-0.5/_index.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,17 @@ fn foo(mut commands: Commands) {
2424

2525
Systems using the old `commands: &mut Commands` syntax in 0.5 will fail to compile when calling `foo.system()`.
2626

27-
This change was made because {{rust_type(type="struct" crate="bevy_ecs" mod="system" version="0.5.0" name="Commands" no_mod=true)}}
28-
now holds an internal {{rust_type(type="struct" crate="bevy_ecs" mod="world" version="0.5.0" name="World" no_mod=true)}}
27+
This change was made because [`Commands`] now holds an internal [`World`]
2928
reference to enable safe entity allocations.
3029

31-
Note: The internal {{rust_type(type="struct" crate="bevy_ecs" mod="world" version="0.5.0" name="World" no_mod=true)}} reference requires two lifetime parameters to pass Commands into a non-system function: `commands: &'a mut Commands<'b>`
30+
Note: The internal [`World`] reference requires two lifetime parameters to pass Commands into a non-system function: `commands: &'a mut Commands<'b>`
31+
32+
[`Commands`]: https://docs.rs/bevy/0.5.0/bevy/ecs/system/struct.Commands.html
33+
[`World`]: https://docs.rs/bevy/0.5.0/bevy/ecs/world/struct.World.html
3234

3335
### Commands API
3436

35-
The {{rust_type(type="struct" crate="bevy_ecs" version="0.5.0" mod="system" name="Commands" no_mod=true)}} API has been completely reworked for consistency with the {{rust_type(type="struct" crate="bevy_ecs" mod="world" version="0.5.0" name="World" no_mod=true)}} API.
37+
The [`Commands`] API has been completely reworked for consistency with the [`World`] API.
3638

3739
```rust
3840
// 0.4
@@ -97,12 +99,15 @@ if timer.tick(time.delta()).finished() { /* do stuff */ }
9799
timer.elapsed() // returns a `Duration`
98100
```
99101

100-
Most of the methods of {{rust_type(type="struct" crate="bevy_core" version="0.5.0" name="Timer" no_mod=true)}}
101-
now use `Duration` instead of `f32`.
102+
Most of the methods of [`Timer`]
103+
now use [`Duration`] instead of `f32`.
102104

103105
This change allows timers to have consistent, high precision. For convenience, there is also an
104106
`elapsed_secs` method that returns `f32`. Otherwise, when you need an `f32`, use the
105-
`as_secs_f32()` method on `Duration` to make the conversion.
107+
`as_secs_f32()` method on [`Duration`] to make the conversion.
108+
109+
[`Timer`]: https://docs.rs/bevy/0.5.0/bevy/core/struct.Timer.html
110+
[`Duration`]: https://docs.rs/bevy/0.5.0/bevy/utils/struct.Duration.html
106111

107112
### Simplified Events
108113

content/learn/book/migration-guides/0.5-0.6/_index.md

Lines changed: 61 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ members = [ "my_crate1", "my_crate2" ]
2929

3030
### "AppBuilder" was merged into "App"
3131

32-
All functions of {{rust_type(type="struct" crate="bevy_app" mod="" version="0.5.0" name="AppBuilder" no_mod=true)}} were merged into {{rust_type(type="struct" crate="bevy_app" mod="" version="0.6.0" name="App" no_mod=true)}}.
32+
All functions of [`AppBuilder`] were merged into [`App`].
3333

34-
In practice this means that you start constructing an {{rust_type(type="struct" crate="bevy_app" mod="" version="0.6.0" name="App" no_mod=true)}} by calling {{rust_type(type="struct" crate="bevy_app" mod="" version="0.6.0" name="App" no_mod=true method="new")}} instead of {{rust_type(type="struct" crate="bevy_app" mod="" version="0.5.0" name="App" no_mod=true method="build")}} and {{rust_type(type="trait" crate="bevy_app" mod="" version="0.5.0" name="Plugin" no_mod=true method="build")}} takes a {{rust_type(type="struct" crate="bevy_app" mod="" version="0.6.0" name="App" no_mod=true)}} instead of a {{rust_type(type="struct" crate="bevy_app" mod="" version="0.5.0" name="AppBuilder" no_mod=true)}}
34+
In practice this means that you start constructing an [`App`] by calling [`App::new`] instead of [`App::build`] and [`Plugin::build`] takes a [`App`] instead of a [`AppBuilder`].
3535

3636
```rs
3737
// 0.5
@@ -61,9 +61,15 @@ impl Plugin for SomePlugin {
6161
}
6262
```
6363

64+
[`AppBuilder`]: https://docs.rs/bevy/0.5.0/bevy/app/struct.AppBuilder.html
65+
[`App`]: https://docs.rs/bevy/0.6.0/bevy/app/struct.App.html
66+
[`App::new`]: https://docs.rs/bevy/0.6.0/bevy/app/struct.App.html#method.new
67+
[`App::build`]: https://docs.rs/bevy/0.5.0/bevy/app/struct.App.html#method.build
68+
[`Plugin::build`]: https://docs.rs/bevy/0.6.0/bevy/app/trait.Plugin.html#tymethod.build
69+
6470
### The "Component" trait now needs to be derived
6571

66-
Bevy no longer has a blanket implementation for the {{rust_type(type="trait" crate="bevy_ecs" mod="component" version="0.6.0" name="Component" no_mod=true)}} trait.
72+
Bevy no longer has a blanket implementation for the [`Component`] trait.
6773
Instead you need to derive (or manualy implement) the trait for every Type that needs it.
6874

6975
```rust
@@ -82,9 +88,11 @@ In order to use foreign types as components, wrap them using the newtype pattern
8288
struct Cooldown(std::time::Duration);
8389
```
8490

91+
[`Component`]: https://docs.rs/bevy/0.6.0/bevy/ecs/component/trait.Component.html
92+
8593
### Setting the Component Storage is now done in "Component" Trait
8694

87-
The change to deriving {{rust_type(type="trait" crate="bevy_ecs" mod="component" version="0.6.0" name="Component" no_mod=true)}}, enabled setting the Component Storage at compiletime instead of runtime.
95+
The change to deriving [`Component`], enabled setting the Component Storage at compiletime instead of runtime.
8896

8997
```rust
9098
// 0.5
@@ -145,9 +153,9 @@ fn main() {
145153

146154
### ".single()" and ".single_mut()" are now infallible
147155

148-
The functions {{rust_type(type="struct" crate="bevy_ecs" mod="system" version="0.6.0" name="Query" no_mod=true method="single")}} and {{rust_type(type="struct" crate="bevy_ecs" mod="system" version="0.6.0" name="Query" no_mod=true method="single_mut")}} no longer return a {{rust_type(type="enum", crate="std" mod="result", name="Result", no_mod=true)}} and Panic instead, if not exactly one Entity was found.
156+
The functions [`Query::single()`] and [`Query::single_mut()`] no longer return a `Result` and instead panic unless exactly one entity was found.
149157

150-
If you need the old behavior you can use the fallible {{rust_type(type="struct" crate="bevy_ecs" mod="system" version="0.6.0" name="Query" no_mod=true method="get_single")}} and {{rust_type(type="struct" crate="bevy_ecs" mod="system" version="0.6.0" name="Query" no_mod=true method="get_single_mut")}} instead.
158+
If you need the old behavior you can use the fallible [`Query::get_single()`] and [`Query_get_single_mut()`] instead.
151159

152160
```rs
153161
// 0.5
@@ -168,6 +176,11 @@ fn player_system_fallible(query: Query<&Transform, With<Player>>) {
168176
}
169177
```
170178

179+
[`Query::single()`]: https://docs.rs/bevy/0.6.0/bevy/ecs/system/struct.Query.html#method.single
180+
[`Query::single_mut()`]: https://docs.rs/bevy/0.6.0/bevy/ecs/system/struct.Query.html#method.single_mut
181+
[`Query::get_single`]: https://docs.rs/bevy/0.6.0/bevy/ecs/system/struct.Query.html#method.get_single
182+
[`Query_get_single_mut`]: https://docs.rs/bevy/0.6.0/bevy/ecs/system/struct.Query.html#method.get_single_mut
183+
171184
### "Light" and "LightBundle" are now "PointLight" and "PointLightBundle"
172185

173186
```rust
@@ -194,18 +207,17 @@ commands.spawn_bundle(PointLightBundle {
194207
});
195208
```
196209

197-
The {{rust_type(type="struct" crate="bevy_pbr" mod="" version="0.5.0" name="Light" no_mod=true)}} and {{rust_type(type="struct" crate="bevy_pbr" mod="" version="0.5.0" name="LightBundle" no_mod=true)}} were renamed to {{rust_type(type="struct" crate="bevy_pbr" mod="" version="0.6.0" name="PointLight" no_mod=true)}} and {{rust_type(type="struct" crate="bevy_pbr" mod="" version="0.6.0" name="PointLightBundle" no_mod=true)}} to more clearly communicate the behavior of the Light Source.
198-
At the same time the `fov` and `depth` fields were removed from the {{rust_type(type="struct" crate="bevy_pbr" mod="" version="0.6.0" name="PointLight" no_mod=true)}} as they were unused.
199-
200-
<!-- TODO: Remove this comment if https://github.com/bevyengine/bevy/pull/2367 is merged.
210+
The [`Light`] and [`LightBundle`] types were renamed to [`PointLight`] and [`PointLightBundle`] to more clearly communicate the behavior of the Light Source.
211+
At the same time the `fov` and `depth` fields were removed from [`PointLight`] as they were unused.
201212

202-
In addition the {{rust_type(type="struct" crate="bevy_pbr" mod="" version="0.6.0" name="DirectionalLight" no_mod=true)}} and {{rust_type(type="struct" crate="bevy_pbr" mod="" version="0.6.0" name="DirectionalLightBundle" no_mod=true)}} were introduced with `0.6`.
203-
204-
-->
213+
[`Light`]: https://docs.rs/bevy/0.5.0/bevy/pbr/struct.Light.html
214+
[`LightBundle`]: https://docs.rs/bevy/0.5.0/bevy/pbr/struct.LightBundle.html
215+
[`PointLight`]: https://docs.rs/bevy/0.6.0/bevy/pbr/struct.PointLight.html
216+
[`PointLightBundle`]: https://docs.rs/bevy/0.6.0/bevy/pbr/struct.PointLightBundle.html
205217

206218
### System Param Lifetime Split
207219

208-
The Lifetime of {{rust_type(type="trait" crate="bevy_ecs" mod="system" version="0.5.0" name="SystemParam" no_mod=true)}} was split in two separate Lifetimes.
220+
The Lifetime of [`SystemParam`] was split in two separate Lifetimes.
209221

210222
```rust
211223
// 0.5
@@ -229,11 +241,11 @@ struct SystemParamDerive<'w, 's> {
229241
}
230242
```
231243

232-
### QuerySet declare "QueryState" instead of "Query"
244+
[`SystemParam`]: https://docs.rs/bevy/0.6.0/bevy/ecs/system/trait.SystemParam.html
233245

234-
<!-- Adapt for ParamSet instead, if https://github.com/bevyengine/bevy/pull/2765 is merged -->
246+
### QuerySet declare "QueryState" instead of "Query"
235247

236-
Due to the [System Param Lifetime Split](#system-param-lifetime-split), {{rust_type(type="struct" crate="bevy_ecs" mod="system" name="QuerySet" version="0.6.0" no_mod=true plural=true)}} now need to specify their Queries with {{rust_type(type="struct" crate="bevy_ecs" mod="query" version="0.6.0" name="QueryState" no_mod=true)}} instead of {{rust_type(type="struct" crate="bevy_ecs" mod="system" version="0.6.0" name="Query" no_mod=true)}}.
248+
Due to the [System Param Lifetime Split](#system-param-lifetime-split), [`QuerySet`] system parameters now need to specify their Queries with [`QuerySet`] instead of [`Query`].
237249

238250
```rust
239251
// 0.5
@@ -247,21 +259,31 @@ fn query_set(mut queries: QuerySet<(QueryState<&mut Transform>, QueryState<&Tran
247259
}
248260
```
249261

262+
[`QuerySet`]: https://docs.rs/bevy/0.6.0/bevy/ecs/system/struct.QuerySet.html
263+
[`QueryState`]: https://docs.rs/bevy/0.6.0/bevy/ecs/query/struct.QueryState.html
264+
[`Query`]: https://docs.rs/bevy/0.6.0/bevy/ecs/system/struct.Query.html
265+
250266
### "Input\<T\>.update()" is renamed to "Input\<T\>.clear()"
251267

252-
The {{rust_type(type="struct" crate="bevy_input" mod="" version="0.5.0" name="Input" no_mod=true method="update")}} function was renamed to {{rust_type(type="struct" crate="bevy_input" mod="" version="0.6.0" name="Input" no_mod=true method="clear")}}.
268+
The [`Input::update`] function was renamed to [`Input::clear`].
269+
270+
[`Input::update`]: https://docs.rs/bevy/0.5.0/bevy/input/struct.Input.html#method.update
271+
[`Input::clear`]: https://docs.rs/bevy/0.6.0/bevy/input/struct.Input.html#method.clear
253272

254273
### "SystemState" is now "SystemMeta"
255274

256-
The {{rust_type(type="struct" crate="bevy_ecs" mod="system" version="0.5.0" name="SystemState" no_mod=true)}} struct, which stores the metadata of a System, was renamed to {{rust_type(type="struct" crate="bevy_ecs" mod="system" version="0.6.0" name="SystemMeta" no_mod=true)}}.
275+
The struct formerly known as [`SystemState`](https://docs.rs/bevy/0.5.0/bevy/ecs/system/struct.SystemState.html), which stores the metadata of a System, was renamed to [`SystemMeta`].
257276

258-
This was done to accommodate the new {{rust_type(type="struct" crate="bevy_ecs" mod="system" version="0.6.0" name="SystemState" no_mod=true)}} which allows easier cached access to {{rust_type(type="trait" crate="bevy_ecs" mod="system" version="0.6.0" name="SystemParam" no_mod=true plural=true)}} outside of a regular System.
277+
This was done to accommodate the new [`SystemState`] which allows easier cached access to [`SystemParam`] outside of a regular System.
278+
279+
[`SystemState`]: https://docs.rs/bevy/0.6.0/bevy/ecs/system/struct.SystemState.html
280+
[`SystemMeta`]: https://docs.rs/bevy/0.6.0/bevy/ecs/system/struct.SystemMeta.html
259281

260282
<!-- TODO: Link to entry for SystemState in the release blog post. -->
261283

262284
### Vector casting functions are now named to match return type
263285

264-
The casting functions for {{rust_type(type="struct" crate="bevy" mod="math" version="0.6.0" name="IVec2" no_mod=true)}}, {{rust_type(type="struct" crate="bevy" mod="math" version="0.6.0" name="DVec2" no_mod=true)}}, {{rust_type(type="struct" crate="bevy" mod="math" version="0.6.0" name="UVec2" no_mod=true)}}, {{rust_type(type="struct" crate="bevy" mod="math" version="0.6.0" name="Vec2" no_mod=true)}} have all been changed from being named after their inner elements' cast target to what the entire "Vec" is being casted into. This affects all the different dimensions of the math vectors (i.e., {{rust_type(type="struct" crate="bevy" mod="math" version="0.6.0" name="Vec2" no_mod=true)}}, {{rust_type(type="struct" crate="bevy" mod="math" version="0.6.0" name="Vec3" no_mod=true)}} and {{rust_type(type="struct" crate="bevy" mod="math" version="0.6.0" name="Vec4" no_mod=true)}}).
286+
The casting functions for [`IVec2`], [`DVec2`], [`UVec2`], and [`Vec2`] have all been changed from being named after their inner elements' cast target to what the entire "Vec" is being casted into. This affects all the different dimensions of the math vectors (i.e., [`Vec2`], [`Vec3` ]and [`Vec4`]).
265287

266288
```rust
267289
// 0.5
@@ -273,13 +295,22 @@ let xyz: Vec3 = Vec3::new(0.0, 0.0, 0.0);
273295
let xyz: IVec3 = xyz.as_ivec3();
274296
```
275297

298+
[`IVec2`]: https://docs.rs/bevy/0.6.0/bevy/math/struct.IVec2.html
299+
[`DVec2`]: https://docs.rs/bevy/0.6.0/bevy/math/struct.DVec2.html
300+
[`UVec2`]: https://docs.rs/bevy/0.6.0/bevy/math/struct.UVec2.html
301+
[`Vec2`]: https://docs.rs/bevy/0.6.0/bevy/math/struct.Vec2.html
302+
[`Vec3`]: https://docs.rs/bevy/0.6.0/bevy/math/struct.Vec3.html
303+
[`Vec4`]: https://docs.rs/bevy/0.6.0/bevy/math/struct.Vec4.html
304+
276305
### StandardMaterial's "roughness" is renamed to "perceptual_roughness"
277306

278-
The {{rust_type(type="struct" crate="bevy_pbr" mod="" version="0.6.0" name="StandardMaterial" no_mod=true)}} field `roughness` was renamed to `perceptual_roughness`.
307+
The [`StandardMaterial`] field `roughness` was renamed to `perceptual_roughness`.
308+
309+
[`StandardMaterial`]: https://docs.rs/bevy/0.6.0/bevy/pbr/struct.StandardMaterial.html
279310

280311
### SpriteBundle and Sprite
281312

282-
The {{rust_type(type="struct" crate="bevy_sprite" mod="" version="0.6.0" name="SpriteBundle" no_mod=true)}} now uses a `texture` handle rather than a `material`. The `color` field of the material is now directly available inside of the {{rust_type(type="struct" crate="bevy_sprite" mod="" version="0.6.0" name="Sprite" no_mod=true)}} struct, which also had its `resize_mode` field replaced with a `custom_size`. The following example shows how to spawn a tinted sprite at a particular size. For simpler cases, check out the updated [sprite](https://github.com/bevyengine/bevy/blob/v0.6.0/examples/2d/sprite.rs) and [rect](https://github.com/bevyengine/bevy/blob/v0.6.0/examples/2d/rect.rs) examples.
313+
The [`SpriteBundle`] bundle type now uses a `texture` handle rather than a `material`. The `color` field of the material is now directly available inside of the [`Sprite`] struct, which also had its `resize_mode` field replaced with a `custom_size`. The following example shows how to spawn a tinted sprite at a particular size. For simpler cases, check out the updated [sprite](https://github.com/bevyengine/bevy/blob/v0.6.0/examples/2d/sprite.rs) and [rect](https://github.com/bevyengine/bevy/blob/v0.6.0/examples/2d/rect.rs) examples.
283314

284315
```rust
285316
// 0.5
@@ -308,8 +339,11 @@ SpriteBundle {
308339
}
309340
```
310341

342+
[`SpriteBundle`]: https://docs.rs/bevy/0.6.0/bevy/sprite/struct.SpriteBundle.html
343+
[`Sprite`]: https://docs.rs/bevy/0.6.0/bevy/sprite/struct.Sprite.html
344+
311345
### Visible is now Visibility
312-
The {{rust_type(type="struct" crate="bevy" mod="render::draw" version="0.5.0" name="Visible" no_mod=true)}} struct, which is used in a number of components to set visibility, was renamed to {{rust_type(type="struct" crate="bevy" mod="render::view" version="0.6.0" name="Visibility" no_mod=true)}}. Additionally, the field `is_transparent` was removed from the struct. For 3D, transparency can be set using the `alpha_mode` field on a material. Transparency is now automatically enabled for all objects in 2D.
346+
The [`Visible`] struct, which is used in a number of components to set visibility, was renamed to [`Visibility`]. Additionally, the field `is_transparent` was removed from the struct. For 3D, transparency can be set using the `alpha_mode` field on a material. Transparency is now automatically enabled for all objects in 2D.
313347

314348
```rust
315349
// 0.5
@@ -342,3 +376,6 @@ commands.spawn_bundle(PbrBundle {
342376
..Default::default()
343377
});
344378
```
379+
380+
[`Visible`]: https://docs.rs/bevy/0.5.0/bevy/prelude/struct.Visible.html
381+
[`Visibility`]: https://docs.rs/bevy/0.6.0/bevy/prelude/struct.Visibility.html#

content/learn/book/welcome/apps/_index.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ template = "book-section.html"
55
page_template = "book-section.html"
66
+++
77

8-
Bevy programs store and execute all of their game logic and data with a single {{rust_type(type="struct" crate="bevy" mod = "app" name="App" no_mod = "true")}} data structure.
8+
Bevy programs store and execute all of their game logic and data with a single [`App`] data structure.
99

1010
Let's make a trivial Hello World app to demonstrate how that works in practice.
11-
The process is straightforward: we first create a new {{rust_type(type="struct" crate="bevy" mod = "app" name="App" no_mod = "true")}}.
11+
The process is straightforward: we first create a new [`App`].
1212
Then, we add a simple system, which prints "Hello, Bevy!" when it is run.
13-
Finally once we're done configuring the app, we call {{rust_type(type="struct" crate="bevy" mod = "app" name="App" method="run" no_mod = "true")}} to actually make our app *do things*.
13+
Finally once we're done configuring the app, we call [`App`] to actually make our app *do things*.
1414

1515
```rust
1616
use bevy::prelude::*;
@@ -28,18 +28,18 @@ fn hello(){
2828

2929
## What makes an App?
3030

31-
So, what sort of data does our {{rust_type(type="struct" crate="bevy" mod = "app" name="App" no_mod = "true")}} really store?
31+
So, what sort of data does our [`App`] really store?
3232
Looking at the docs linked, we find three fields: `world`, `schedule` and `runner`.
3333
The `world` field stores all of our game's data, the `schedule` holds the systems that operate on this data (and the order in which they do so) and the `runner` interprets the schedule to control the broad execution strategy.
3434
You can read more about these by exploring the reference documentation linked just above.
3535

3636
Generally, you'll be operating at a more granular level than these basic primitives: controlling data in terms of specific resources or components and adding systems to an existing schedule.
37-
To do so, customize your own {{rust_type(type="struct" crate="bevy" mod = "app" name="App" no_mod = "true")}} by chaining its methods with the [builder pattern](https://doc.rust-lang.org/1.0.0/style/ownership/builders.html).
37+
To do so, customize your own [`App`] by chaining its methods with the [builder pattern](https://doc.rust-lang.org/1.0.0/style/ownership/builders.html).
3838
The most basic tools are:
3939

40-
1. Initializing resources in the {{rust_type(type="struct" crate="bevy" mod = "ecs/world" name="World" no_mod = "true")}} to store globally available data that we only need a single copy of.
41-
2. Adding systems to our {{rust_type(type="struct" crate="bevy" mod = "ecs/schedule" name="Schedule" no_mod = "true")}}, which can read and modify resources and our entities' components, according to our game logic.
42-
3. Importing other blocks of {{rust_type(type="struct" crate="bevy" mod = "app" name="App" no_mod = "true")}}-modifying code using plugins.
40+
1. Initializing resources in the [`World`] to store globally available data that we only need a single copy of.
41+
2. Adding systems to our [`Schedule`], which can read and modify resources and our entities' components, according to our game logic.
42+
3. Importing other blocks of [`App`]-modifying code using [`Plugins`].
4343
Let's write a very simple demo that shows how those work.
4444

4545
```rust
@@ -68,3 +68,8 @@ fn read_message(message: Res<Message>) {
6868
println!(message.string);
6969
}
7070
```
71+
72+
[`App`]: https://docs.rs/bevy/latest/bevy/app/struct.App.html
73+
[`World`]: https://docs.rs/bevy/latest/bevy/ecs/world/struct.World.html
74+
[`Schedule`]: https://docs.rs/bevy/latest/bevy/ecs/schedule/struct.Schedule.html
75+
[`Plugins`]: https://docs.rs/bevy/latest/bevy/app/trait.Plugin.html

0 commit comments

Comments
 (0)