DarkMatter.Structs (DarkMatter v1.1.2) View Source

Utils for working with structs.

Link to this section Summary

Functions

Determine keys for a given module or raises ArgumentError.

Determine if a given key is a meta map property.

Link to this section Functions

Specs

keys(module() | struct()) :: [atom()]

Determine keys for a given module or raises ArgumentError.

Examples

iex> keys(IO.Stream)
[:device, :line_or_bytes, :raw]

iex> keys(%IO.Stream{})
[:device, :line_or_bytes, :raw]

iex> keys(%{})
** (FunctionClauseError) no function clause matching in DarkMatter.Structs.keys/1

Specs

meta_key?(atom()) :: boolean()

Determine if a given key is a meta map property.

Examples

iex> meta_key?(:__meta__)
true

iex> meta_key?(:__struct__)
true

iex> meta_key?(:non_meta)
false