amethyst / specs

Specs - Parallel ECS
https://amethyst.github.io/specs/
Apache License 2.0
2.49k stars 219 forks source link

specs-derive better 'storage' macro parameter #773

Closed ClaasJG closed 4 months ago

ClaasJG commented 4 months ago

Hi and thanks for specs.

Description

Currently it is not possible to specify a storage type with specs-derive that expects special generics. This is because specs-derive assumes <Self>https://github.com/amethyst/specs/blob/708c3ac436e9cad285babd61caf54fa15a0edace/specs-derive/src/lib.rs#L73 and this cannot be overwritten. It should be possible to specify other generics.

Motivation

It is currently not possible to specify e.g. FlaggedStorage with the 'storage' macro.

#[derive(Component)]
#[storage(DerefFlaggedStorage<Self,DenseVecStorage<Self>>)]
pub struct Foo {}

Although 'Component' can be implemented traditionally, it is irritating if this has to be done for some types of storage and not for others. This also means additional work, which the derive macro is designed to avoid from the outset.

Drawbacks

None


I asked about this on gitter, and will create a pull request, which 'fixes' this request.

-ClaasJG