amethyst / amethyst/specs

Can't use derive macro for Component if specs::Component is used under another name

Open
#719 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2.6k
Forks
215
PR merge metrics
No merged PRs in 30d

Description

The derive macro for components seems to be assuming that the literal string "Component" in my source code is going to point to `specs::Component`.

https://github.com/amethyst/specs/blob/d4435bdf496cf322c74886ca09dd8795984919b4/specs-derive/src/lib.rs#L72

This isn't true if I have my own `Component` type and I have done something like `use specs::Component as SComponent;`. It's also not true if I'm also using another library using similar code that wants ownership of the non-namespaced name `Component`.

The macro should be changed to use a fully-qualified `specs::Component`, so it can coexist with `Component`s from other crates.

Or am I doing something very wrong?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.