Drvi / ProtocolBuffers.jl

4 stars 0 forks source link

Add generic fallback to metadata methods #5

Closed Drvi closed 2 years ago

Drvi commented 2 years ago

"Metadata methods" now have a generic fallback which returns an "empty" result for any type that doesn't overload them. They are also no longer generated for structs which don't need them.

oneof_field_types now also returns a named tuple instance instead of NamedTuple type representing the names and types of oneof options. This has the benefit of providing a nicer syntax for accessing the types, e.g.

oneof_field_types(MyType).oneof_field_name.option_name # returns type corresponding to `option_name`