Closed Imberflur closed 3 years ago
I'm currently leaning towards leaving this functionality out of this crate but I thought it would be interesting to see what it could look like.
let my_scope = manual_scope!(...);
and then they would drop(my_scope)
I agree with you on leaning towards leaving it out for now. Thanks for sharing the the experiment, maybe something will change in the future that makes it an easier sell. Happy to take another look in the future if you come up with something! :)
If we had a canonical name for it (like _profiling_guard) then someone could drop it purposefully (undocumented feature - I'd be more comfortable with it not working with one of the profilers if it's not "fully supported" API :) )
I think macro hygiene means the user needs to specify the name to be able to access it. I might not understand what you are proposing here though.
If we did something like this, I'd want the api to be like let my_scope = manual_scope!(...); and then they would drop(my_scope)
That would work as well and feels like a more natural api. I was mainly inspired by the span!
macro wgpu uses internally. I think their reason for including the let
in the macro was to help keep the usage of the macro on a single line.
Optick behaving inconsistently with the rest of the APIs might be a deal-breaker for this to be a first-class part of the API
yeah :/ theoretically we could just mimic their macro but that involves unsafe
and I didn't feel comfortable pulling that in here
Closing for now but happy to take another look if you have more ideas :)
Attempt at #3