A.OrdMap.from_struct
You're seeing just the function
from_struct
, go back to A.OrdMap module for more information.
Specs
Converts a struct
to an ordered map.
It accepts the struct module or a struct itself and
simply removes the __struct__
field from the given struct
or from a new struct generated from the given module.
Example
defmodule User do
defstruct [:name, :age]
end
A.OrdMap.from_struct(User)
ord(%{age: nil, name: nil})
A.OrdMap.from_struct(%User{name: "john", age: 44})
ord(%{age: 44, name: "john"})