Implement IEquatable in autogenerated C# enums#4527
Open
GEFNENEN wants to merge 1 commit intoclockworklabs:masterfrom
Open
Implement IEquatable in autogenerated C# enums#4527GEFNENEN wants to merge 1 commit intoclockworklabs:masterfrom
GEFNENEN wants to merge 1 commit intoclockworklabs:masterfrom
Conversation
Updated C# enum generation to implement IEquatable interface and added Equals method. Signed-off-by: miXin <52082254@qq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
This PR fixes a compilation error in C# bindings when using Rust enums as primary keys. The issue occurs because generated C# enums don't implement the
IEquatable<T>interface, which is required by SpacetimeDB's indexing system.The fix modifies the
autogen_csharp_plain_enumfunction incrates/codegen/src/csharp.rsto:IEquatable<T>to the enum declarationEquals()method implementationThis only affects plain enums (without payload) and does not impact tagged enums which use a different code generation path (
autogen_csharp_sum).API and ABI breaking changes
No API or ABI breaking changes. This is a purely additive change that only affects generated C# code to implement an additional interface.
Expected complexity level and risk
Complexity: 1/5 (Trivial change)
This is a minimal change involving only 2-3 lines of code in a single function. The modification is straightforward:
The change has low risk because:
autogen_csharp_sum) and are unaffectedIsEquatableproperty inColumnDeclaration)Testing
The change should be tested by: