Elixir 1.14's new :optional option when deriving Inspect protocol

Elixir 1.14 introduced a new option when deriving the Inspect protocol for a struct.

We already had the :only and :except options.

Elixir 1.14 introduces the :optional option.

It displays the values for those keys only when they differ from their defaults. Not sure when I’d use it (yet), but found it interesting!

Want the latest Elixir Streams in your inbox?

    No spam. Unsubscribe any time.