amoc_config_attributes (amoc v4.1.1)

View Source

Summary

Types

attribute_name/0

-type attribute_name() :: required_variable | override_variable.

error/0

-type error() :: {error, error_type(), reason()}.

error_type/0

-type error_type() :: atom().

maybe_module_attribute/0

-type maybe_module_attribute() :: module_attribute() | term().

maybe_module_config/0

-type maybe_module_config() :: {ok, [module_parameter()]} | error().

maybe_update_fun/0

-type maybe_update_fun() :: update_fun() | fun((_, _) -> any()).

maybe_update_method/0

-type maybe_update_method() :: update_method() | term().

maybe_verification_fun/0

-type maybe_verification_fun() :: verification_fun() | fun((_) -> any()).

maybe_verification_method/0

-type maybe_verification_method() :: verification_method() | term().

mfa/1

-type mfa(Arity) :: {module(), atom(), Arity}.

module_attribute/0

-type module_attribute() ::
          #{name := name(),
            description := unicode:chardata(),
            default_value => value(),
            verification => verification_method(),
            update => update_method()}.

module_parameter/0

-type module_parameter() ::
          #module_parameter{name :: name(),
                            mod :: module(),
                            value :: value(),
                            description :: unicode:chardata(),
                            scope :: scope(),
                            verification_fn :: maybe_verification_fun(),
                            update_fn :: maybe_update_fun() | read_only}.

name/0

-type name() :: atom().

one_of/0

-type one_of() :: [value(), ...].

reason/0

-type reason() :: any().

scope/0

-type scope() :: local | global.

update_fun/0

-type update_fun() :: fun((ParamName :: name(), NewValue :: value()) -> any()).

update_method/0

-type update_method() :: read_only | none | mfa(2) | update_fun().

value/0

-type value() :: any().

verification_fun/0

-type verification_fun() ::
          fun((Value :: value()) -> boolean() | {true, NewValue :: value()} | {false, reason()}).

verification_method/0

-type verification_method() :: none | one_of() | mfa(1) | verification_fun().

Functions

get_module_configuration(AttrName, Module)

-spec get_module_configuration(attribute_name(), module()) -> maybe_module_config().

none(_)

-spec none(any()) -> true.

none(_, _)

-spec none(any(), any()) -> ok.