getty-zig / getty

A (de)serialization framework for Zig
https://getty.so
MIT License
183 stars 14 forks source link

de: Better autodocs for interface methods #136

Closed ibokuri closed 10 months ago

ibokuri commented 10 months ago

Better Documentation

Before this PR, getty.de.MapAccess's documentation looked like this:

image

After this PR, its documentation looks like this:

image

And if you click on one of the method types, you are sent to the source code where you can clearly see the full signature of the method.

image

Clearer Optionality

Also, notice the difference between nextKeySeed's type and nextKey's types in the second screenshot. The former is not prefixed with a ?. While all interface methods are technically optional (for reasons irrelevant to this PR), some methods are "provided" by Getty for the user's convenience (i.e., they have a default implementation that is used if the user doesn't provide one).

Provided methods are now prefixed with a ? to indicate their optionality, while "required" methods do not display the leading ? in order to indicate to the user that they do not have default implementations.