View Source Estructura.Aston (estructura v1.6.0)
The implementation of Estructura
ready to work with tree AST-like structure
Summary
Functions
Returns the generator to be used in StreamData
-powered property testing, based
on the specification given to use Estructura
, which contained
Returns the key to be used for accessing the nested element(s)
Coerces the deeply nested map to an instance of nested Estructura.Aston
Gets the value for the given key from the structure
Puts the value for the given key into the structure, passing coercion and validation,
returns {:ok, updated_struct}
or {:error, reason}
if there is no such key
Puts the value for the given key into the structure, passing coercion and validation, returns the value or raises if there is no such key
Converts Estructura.Aston
to the XML AST understandable by XmlBuilder
Types
Functions
@spec __generator__(%Estructura.Aston{ attributes: term(), content: term(), name: term() }) :: StreamData.t(%Estructura.Aston{ attributes: term(), content: term(), name: term() })
Returns the generator to be used in StreamData
-powered property testing, based
on the specification given to use Estructura
, which contained
shape
%Estructura.Config{
access: true,
coercion: true,
validation: true,
calculated: [],
collectable: :content,
enumerable: true,
generator: [
name: {StreamData, :string, [:alphanumeric]},
attributes: {StreamData, :map_of,
[
{StreamData, :atom, [:alphanumeric]},
{StreamData, :one_of,
[
[
{StreamData, :integer},
{StreamData, :boolean},
{StreamData, :string, [:alphanumeric]}
]
]}
]},
content: {StreamData, :tree,
[{StreamData, :fixed_list, [[]]}, &Estructura.Aston.child_gen/1]}
]
}
The argument given would be used as a template to generate new values.
Returns the key to be used for accessing the nested element(s)
@spec coerce(any(), keyword(), nil | any()) :: {:ok, value} | {:error, reason} when value: any(), reason: String.t()
Coerces the deeply nested map to an instance of nested Estructura.Aston
@spec get( %Estructura.Aston{attributes: term(), content: term(), name: term()}, Estructura.Config.key(), any() ) :: any()
Gets the value for the given key from the structure
@spec put( %Estructura.Aston{attributes: term(), content: term(), name: term()}, Estructura.Config.key(), any() ) :: {:ok, %Estructura.Aston{attributes: term(), content: term(), name: term()}} | {:error, any()}
Puts the value for the given key into the structure, passing coercion and validation,
returns {:ok, updated_struct}
or {:error, reason}
if there is no such key
@spec put!( %Estructura.Aston{attributes: term(), content: term(), name: term()}, Estructura.Config.key(), any() ) :: %Estructura.Aston{attributes: term(), content: term(), name: term()} | no_return()
Puts the value for the given key into the structure, passing coercion and validation, returns the value or raises if there is no such key
@spec to_ast(t()) :: {element, map(), content} when element: atom() | binary(), content: nil | binary() | list()
Converts Estructura.Aston
to the XML AST understandable by XmlBuilder