It's tricker in this case. I have to pass something in as a proc macro argument that then gets turned into an instance of a data structure.
EDIT: To elaborate a bit on the original post above, the process is like this:
I have three crates: my my_proc_macros crate, the user's upstream crate, and the user's downstream crate. In the user's upstream crate, they declare a data processing macro like this:
use my_proc_macros::preprocess_data;
preprocess_data! {
// Input goes here
}
This process the data and then spawns child macros (still in the upstream crate) to query that data. Those child macros have the data baked-in to their arguments as above:
// This is generated by the preprocess_data! invoke:
macro_rules! query_data{
($(args:tt)*) => ::my_proc_macros::do_query_data!("SGVsbG8gd29ybGQh", $($args)*)
}
Where the "SGVsbG8gd29ybGQh" string literal right now is the base64 encoding of the post-processed data. The my_proc_macros::do_query_data proc macro takes in, as arguments, both the string literal post-processed data blob, along with the arguments for the actual query the user wants to perform, and produces a result. This way, the user in the downstream crate can call query_data! and that downstream macro can access the baked-in encoding of the preprocessed data.