View Source Estructura.LazyMap (estructura v1.5.0)
The implementation of lazy map implementing lazy Access
for its keys.
Estructura.LazyMap
is backed by the “raw” object and a key-value pairs
where values might be instances of Estructura.Lazy
. If this is a case,
they will be accessed through Lazy
implementation.
Values might be also raw values, which makes LazyMap
a drop-in replacement
of standard Elixir maps, assuming they are accessed through Access
only (e. g. map[:key]
and not map.key
.)
Summary
Functions
Eagerly instantiates the data
Returns all the keys of the underlying map
Creates new instance of LazyMap
with a second parameter being a backed up object,
which would be used for lazy retrieving data for values, when value is an instance
of Estructura.Lazy
.
Types
Functions
Eagerly instantiates the data
Returns all the keys of the underlying map
Creates new instance of LazyMap
with a second parameter being a backed up object,
which would be used for lazy retrieving data for values, when value is an instance
of Estructura.Lazy
.
Examples
iex> lm = Estructura.LazyMap.new(
...> [int: Estructura.Lazy.new(&Estructura.LazyInst.parse_int/1)], "42")
...> get_in lm, [:int]
42