No this should be
- defmodule
- defstruct
- @type
It’s a “single declaration” that encapsulates all of the information about the struct. There is nothing else there to confuse the reader (like other types, function definitions, etc). There also isn’t a way for the type declaration to accidentally drift away from the defstruct. Something to keep in mind too is that not everyone types their code, not everyone remembers to update the types, and not all beginners have a full understanding of what the types mean. Nesting the module this way (albeit rare because I don’t usually make “state structs”) is just a convention I have adopted that causes less confusion for those unfamiliar with Elixir.






















