Open ndrewxie opened 3 years ago
Hello, @ndrewxie!
You can use cargo-expand to see how iai::main!
is expaneded, and copy generated code into your source, and than do any set-up and initialization you like.
P.S. I think it would be beneficial to add second macro, that generates not main, but regular function, that can be called from real main by human.
Sorry if this is something that already exists, but I'm unable to find it in the docs:
Let's say I have something I want to benchmark a few methods of a struct, but instantiating and setting up the struct is expensive. There should be a feature where I can instantiate and set up the struct outside of the benchmark, and then pass it into the benchmark to benchmark the relevant methods.