View Source amoc_config_attributes (amoc v3.3.0)

Summary

Types

-type attribute_name() :: required_variable | override_variable.
-type error() :: {error, error_type(), reason()}.
-type error_type() :: atom().
Link to this type

maybe_module_attribute/0

View Source
-type maybe_module_attribute() :: module_attribute() | term().
-type maybe_module_config() :: {ok, [module_parameter()]} | error().
-type maybe_update_fun() :: update_fun() | fun((_, _) -> any()).
-type maybe_update_method() :: update_method() | term().
Link to this type

maybe_verification_fun/0

View Source
-type maybe_verification_fun() :: verification_fun() | fun((_) -> any()).
Link to this type

maybe_verification_method/0

View Source
-type maybe_verification_method() :: verification_method() | term().
-type mfa(Arity) :: {module(), atom(), Arity}.
-type module_attribute() ::
    #{name := name(),
      description := string(),
      default_value => value(),
      verification => verification_method(),
      update => update_method()}.
-type module_parameter() ::
    #module_parameter{name :: name(),
                      mod :: module(),
                      value :: value(),
                      description :: string(),
                      verification_fn :: maybe_verification_fun(),
                      update_fn :: maybe_update_fun() | read_only}.
-type name() :: atom().
-type one_of() :: [value(), ...].
-type reason() :: any().
-type update_fun() :: fun((ParamName :: name(), NewValue :: value()) -> any()).
-type update_method() :: read_only | none | mfa(2) | update_fun().
-type value() :: any().
-type verification_fun() ::
    fun((Value :: value()) -> boolean() | {true, NewValue :: value()} | {false, reason()}).
-type verification_method() :: none | one_of() | mfa(1) | verification_fun().

Functions

Link to this function

get_module_configuration(AttrName, Module)

View Source
-spec get_module_configuration(attribute_name(), module()) -> maybe_module_config().
-spec none(any()) -> true.
-spec none(any(), any()) -> ok.