Skip to content

Commit

Permalink
Add example for #733
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaasJG committed Apr 23, 2024
1 parent c5d1cdd commit 2cefae1
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion docs/tutorials/src/02_hello_world.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,25 @@ struct Velocity {
If the `#[storage(...)]` attribute is omitted, the given component will be
stored in a `DenseVecStorage` by default. But for this example, we are
explicitly asking for these components to be kept in a `VecStorage` instead (see
the later [storages chapter][sc] for more details). But before we move on, we
the later [storages chapter][sc] for more details).

`#[storage(VecStorage)]` assumes `<Self>` as the default type parameter for the storage.
More complex type parameters can be specified explicitly:

```rust,ignore
#[derive(Component, Debug)]
#[storage(FlaggedStorage<Self, DenseVecStorage<Self>>)]
pub struct Data {
[..]
}
```
(see the later [`FlaggedStorage` and modification events chapter][tc] for more details on `FlaggedStorage`)

But before we move on, we
need to create a world in which to store all of our components.

[sc]: ./05_storages.html
[tc]: ./12_tracked.html

## The `World`

Expand Down

0 comments on commit 2cefae1

Please sign in to comment.