Hi.
I'm writing a tool testing tool and would like to hijack imports to the proptest library and redirect it to my custom proptest clone. Redirecting at the Cargo.toml
level is not desirable for this project, so I'm doing this by wrapping the entire file with a translation macro that overwrites use proptest
with use mytool_proptest
. Is there a way to do this without explicitly wrapping the entire file with my translation macro? It seems I cannot use derive
for the entire file, but some similar feature would be nice.
What I currently have.
mytool_translate! {
use proptest::prelude::*;
proptest! {
fn test( x in any<i32>()) {
// ...
}
}
}
Which expands to
use mytool_proptest::prelude::*;
proptest! {
fn test( x in any<i32>()) {
// ...
}
}
What I would like to have:
#![apply_to_entire_file(mytool_translate)]
use proptest::prelude::*;
proptest! {
fn test( x in any<i32>()) {
// ...
}
}
And still have it expand to the same code (code block 2).
Thanks you!