icerpc / icerpc-csharp

A C# RPC framework built for QUIC, with bidirectional streaming, first-class async/await, and Protobuf support.
https://docs.icerpc.dev
Apache License 2.0
108 stars 13 forks source link

Enum with associated fields #3861

Closed bernardnormier closed 11 months ago

bernardnormier commented 11 months ago

This PR implements enum with (associated) fields in C#.

The C# mapping relies on Dunet (https://github.com/domn1995/dunet). A nice feature of Dunet is it's 100% a source generator. The resulting code does not depend on a Dunet assembly at runtime.

Not implemented in this PR (but should be implemented in a follow-up PR):

Note that discriminants are encoded as varint32 (not varuint32), just like tag values.

pepone commented 11 months ago

Dunet is it's 100% a source generator. The resulting code does not depend on a Dunet assembly at runtime.

Does this mean the Dotnet development dependency is only required when you define enums with associated fields?

bernardnormier commented 11 months ago

Dunet is it's 100% a source generator. The resulting code does not depend on a Dunet assembly at runtime.

Does this mean the Dotnet development dependency is only required when you define enums with associated fields?

Yes. But it's Dunet with a 'u'.