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

Re-export custom derives from askama crate #2

Closed
dtolnay opened this issue Mar 6, 2017 · 3 comments
Closed

Re-export custom derives from askama crate #2

dtolnay opened this issue Mar 6, 2017 · 3 comments

Comments

@dtolnay
Copy link
Contributor

dtolnay commented Mar 6, 2017

Custom derive macros can not be exported together with other items, so you have to depend on a separate crate for it.

They can actually. If you are okay requiring Rust >=1.15 to compile askama, you can include this in askama/src/lib.rs:

#[allow(unused_imports)]
#[macro_use]
extern crate askama_derive;
pub use askama_derive::*;

Then users can write:

#[macro_use]
extern crate askama;

and get access to the derives that way.

@djc
Copy link
Collaborator

djc commented Mar 6, 2017

Ah, so a crate can export both, but the crate that contains the proc macro cannot export anything else? As it's currently setup, askama_derive depends on askama, but I guess circular dependencies are not supported, right?

@dtolnay
Copy link
Contributor Author

dtolnay commented Mar 6, 2017

I would prefer to drop the dependency of askama_derive on askama by moving the codegen-related code into the derive crate. Then you can re-export the derive from askama and save users the trouble of depending on two crates.

@djc
Copy link
Collaborator

djc commented Mar 6, 2017

Yeah, that would be much nicer. It was how I set it up initially, but since I misunderstood the exporting restrictions figured that it made more sense to put all the logic together.

@djc djc closed this as completed in 664398b Mar 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants