Implementation of EngineBitfield
trait by Lemiczek · Pull Request #524 · godot-rust/gdext (original) (raw)
This PR partially concerns issue #503 and implements decoupling of enums and bitfields in codegen, in a way, where they are split into an already existing EngineEnum
trait and the newly implemented EngineBitfield
trait, where bitfield ords use u64
whereas enum ords use i32
.
Since this is my first PR on the subject of codegen, there may be logical errors in my assumptions, weird code style, code that doesn't need to be there, or general noob-ish code. Please do tell me about any such issues, so I may learn and improve, and subsequently correct them. :)
Since this PR is splitting off enums and bitfields in a more explicit way, this introduces breaking changes for those that have used a bitfield in their projects prior to this change. Specifically on the importing side of things. Not a huge issue, since the language server should pick up on where the type lives and therefore users can easily fix this.
This implementation can lead to potentially more flexibility to bitfields. We have the bitwise operation BitOr
. Could BitAnd
, BitXor
or BitNot
be useful to implement in some capacity here?
It is my understanding that methods that use bitfields already use the type, and therefore don't need any refactoring, I may be completely wrong in that assumption. If there are any such instances, we should change them in this PR.
Thanks for the feedback.