I recently identified a potential misuse of a crate I've been developping.
The issue is quite simple, and I can easily document it, but I was wondering if it could actually be enforced in third-party code by the compiler.
I have a struct, which has a very limited number of methods:
- (and soon,
This issue there is that the struct in question holds a lot of information needed for the algorithm that is running in some private fields, and the state of those fields is different between after and before calling the
solve method, but could be useful for debugging purpose.
The actual limitation, is that the
solve method should be called once and only once. If you want to solve another problem, you have to instanciate a new struct.
How can I tag this method so that the compiler knows about it. (In my case, the issue arise using criterion for benchmarking)
The struct in question:
Thanks in advance,