carry v0.1.3 Carry

Carry transforms a map into the corresponding Elixir struct without atom waste

Link to this section Summary

Functions

Transform the given map to the corresponding struct Example

Link to this section Functions

Link to this function on(map_or_struct, module)
on(map() | struct(), struct() | atom()) :: struct()

Transform the given map to the corresponding struct Example:

iex> defmodule Instrument, do: defstruct [:carillon]

iex> Carry.on(%{“carillon” => “sound”, “marimba” => “percussion”}, %Instrument{}) %Instrument{carillon: “sound”}

iex> Carry.on(%{“carillon” => “sound”, “marimba” => “percussion”}, Instrument) %Instrument{carillon: “sound”}