Map to struct Mar 3, 2016 Map to struct # given the struct defmodule User do defstruct username: nil end %User{username: "test" } = struct(User, %{username: "test", password: "secret"}) # struct! raises KeyError if un-matching keys provided %User{username: "test" } = struct!(User, %{username: "test", password: "secret"})