You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This seems highly desirable for cargo crev's use case.
From each syn::ItemMod that gets parsed, you can find the Span of the semicolon and use Span::start from proc-macro2's "span-locations" feature to figure out the input file line and column of the semicolon. Then you can replace that semicolon character in the original source string with a set of braces containing an indented content of the child module. The final output would be a string of source code rather than syn::File, which the caller can parse to syn::File if they want.
The text was updated successfully, but these errors were encountered:
This seems highly desirable for
cargo crev
's use case.From each syn::ItemMod that gets parsed, you can find the Span of the semicolon and use Span::start from proc-macro2's "span-locations" feature to figure out the input file line and column of the semicolon. Then you can replace that semicolon character in the original source string with a set of braces containing an indented content of the child module. The final output would be a string of source code rather than syn::File, which the caller can parse to syn::File if they want.
The text was updated successfully, but these errors were encountered: