View Source IEx.Info protocol (IEx v1.14.5)
A protocol to print information in IEx about the given datastructure.
IEx.Helpers.i/1
uses this protocol to display a term-specific list
of of information.
By default, an Any
implementation will be used which returns
the "Data type"
, "Description"
and "Reference modules"
sections.
Link to this section Summary
Functions
Returns information for the given term.
Link to this section Types
@type t() :: term()
Link to this section Functions
@spec info(term()) :: [{info_name :: String.Chars.t(), info :: String.t()}]
Returns information for the given term.
Information should be returned as a list of info_name
-info
tuples,
where info_name
is a string-like value, such as an atom or a string
itself, and info
is a string. info_name
should be short. info
can
be arbitrarily long and contain newlines.
IEx.Helpers.i/1
will generate (and always display)
the 'Implemented protocols' and 'Term' sections in the result.
All other sections of information are added (and can be overridden) by customized implementations of this function.
It is recommended to at least include the following sections for a custom implementation:
"Data type"
: Name of the data type. Usually the name of the module defining the data type."Description"
: One or a few sentences describing what the data type represents."Reference modules
: One or a few comma-separated module names that focus on working with this datatype.
Other recommended sections are:
"Raw representation
: showing another way of writing the passedterm
. This is mostly relevant for data-structures whoseString.Chars
-implementations make use of sigils or other syntactic sugar.