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

Use include_str! to trigger recompile when sample file changes #35

Open
evestera opened this issue Oct 20, 2021 · 0 comments
Open

Use include_str! to trigger recompile when sample file changes #35

evestera opened this issue Oct 20, 2021 · 0 comments

Comments

@evestera
Copy link
Owner

When reading sample from file using the procedural macro (e.g. json_typegen!("Point", "point.json")), if the sample file changes the compiler will not be aware that anything relevant has changed and so will not recompile.

There is a hack we can do to let the compiler know we are using a file. Output code like this in addition to the actual code:

const _: &'static str = include_str!("point.json");

Tracking issue for better way to do this (from which the snippet above was taken): rust-lang/rust#73921

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

1 participant