-
-
Notifications
You must be signed in to change notification settings - Fork 6
Library to inline out-of-line mod items and resolve #[path = "..."] #6
Comments
I'll take a look at this one. |
Should this be done recursively? How should not-found files be handled? They could be made into empty modules, or the top-line API could be changed to return a |
Yes I would like it to be recursive. For my use case I would want not-found modules to simply stay as |
Found a couple bugs; filing them over in the crate repo. |
@dpc is https://docs.rs/syn-inline-mod sufficient for your use case or do you need it to be integrated into a cli? |
@dtolnay After I'll figure out how to convert it to string, and how to find entry points to a given crate, I'll be all set. :) |
@dpc I've been calling |
I don't know what is the best way to find out the crate entry point. This may be a Cargo feature request. The following might work for now: cargo +nightly build -Z unstable-options --build-plan \
| jq -r '.invocations[-1].args[2]' |
Thanks! |
Added link in the readme. Nicely done! |
In dtolnay/cargo-expand#11 I need to be able to take a source file as a
syn::File
and transitively expand everymod m;
intomod m { ... }
with its contents drawn from the right file.Concretely we'll be replacing the
content
field of everyItemMod
with Some if it is None.Example input:
src/lib.rs
src/m1.rs
src/m2.rs
src/empty.rs
// empty file
The result will look like:
Possible API:
The text was updated successfully, but these errors were encountered: