-
Notifications
You must be signed in to change notification settings - Fork 778
Closed
Labels
Description
I'd like to extract information from ParseCallbacks so that it can be used later in the build script.
For example:
I have three C macros:
VERSION_MAJORVERSION_MINORVERSION_PATCH
which all define a number and so get forwarded to ParseCallbacks::int_macro. Now in my implementation of that callback, I want to capture these integers for use later in the build script.
Currently, as I see it, the only option is to use Atomic* or Mutex as the bound on ParseCallbacks specifies UnwindSafe which references to types with interior mutability are not, and the callbacks themselves only get a shared reference to self.
This works but is not pretty and may incur performance penalties for Mutex.
So my questions are:
- What is the preferred strategy for doing something like that?
(More so with a less trivial example that requires more complex data e.g.ParseCallbacks::func_macro) - Why do these functions not get a mutable reference to self if the callbacks don't need to be
Send/Sync?