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
allow system
macro to use a local module for legion behind a feature instead of the crate
#186
Conversation
system
macro to use a local lefion behind a featuresystem
macro to use a local module for legion behind a feature instead of the crate
So amethyst users would have to do |
if mutable { | ||
#[cfg(not(feature = "reexport"))] | ||
query.push( | ||
parse_quote!(::legion::TryWrite<#elem>), | ||
); | ||
#[cfg(feature = "reexport")] | ||
query.push( | ||
parse_quote!(self::legion::TryWrite<#elem>), | ||
); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not put the legion path in a variable? That way you only need one pair of #[cfg(feature = ..)]
, and you avoid a lot of code duplication.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because I didn't think about using a path alias 👍
It depends on how linked legion and amethyst are going to be, and where this link is going to be expressed. |
there's also a
bevy now uses |
it has been some months, any updates on this? |
@mockersf Hello, thanks for the PR and sorry for the massive delay, Thomas is quite busy nowadays, |
Oh I assumed this had been fixed in another way as I saw Amethyst integration make progress and it was quite painful to write systems without that at the time... |
Okay, thank you for the PR! |
fixes #178
This is due to all paths to
legion
in the macro starting with::
which means thatlegion
has to be a crate and not a module.I found this issue when playing with Amethyst where the
system
macro doesn't work with the following error:If I add
legion
as a direct dependency, it works, but it's not ideal because it means everyone usingamethyst
withlegion
would always need to keep both in sync.I added a feature
reexport
that, when enabled, will switch the path prefix from::
toself::
, which means I can now use a re-exportedlegion
module