How to implement Enumerable protocol for struct?

The best example is the source code itself.
https://github.com/elixir-lang/elixir/blob/ae5188d8996f9ab44358be3d7acd4447a2de0677/lib/elixir/lib/enum.ex#L3986-L4007

But note that you cannot rely on the implementation for maps. The only function that will work is member?/2