Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

specs-derive better 'storage' macro parameter #773

Closed
ClaasJG opened this issue Apr 22, 2024 · 0 comments · Fixed by #774
Closed

specs-derive better 'storage' macro parameter #773

ClaasJG opened this issue Apr 22, 2024 · 0 comments · Fixed by #774

Comments

@ClaasJG
Copy link
Contributor

ClaasJG commented Apr 22, 2024

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>

type Storage = #storage<Self>;
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

  • Is it a breaking change?
    No - it is not
  • Can it impact performance, learnability, etc?
    No - I would actually argue, it implements expected behaviour.

Unresolved questions

None


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

-ClaasJG

@ClaasJG ClaasJG mentioned this issue Apr 22, 2024
4 tasks
Imberflur added a commit that referenced this issue Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant