Closed boozook closed 4 weeks ago
Hi, thanks for your report!
The WriteMagic
trait is automatically generated by binrw when you provide a magic
directive. You don’t implement it yourself. The literal type restriction on magic is required to generate a more efficient parsing strategy for mixed type enum variants since it is not possible for a macro to resolve symbolic types. Since you can get the magic literal from the auto-generated trait there is not a good reason to increase the complexity of the parser here. As such, I’m going to close this ticket.
Let me know if this makes sense or if you have any other questions, or if you feel like this is incorrect. Thanks!
Currently
MAGIC
attribute requiresliteral
, but it possible to support constants too, using const resolving or just inlining maybe.Now instead of use const I have to do something like that: