Introspection
Term.Introspection.get_docstring
Term.Introspection.get_methods_with_docstrings
Term.Introspection.inspect
Term.Introspection.typestree
Term.Introspection.get_docstring
— Methodget_docstring(obj)
Extract and style an object's docstring.
Term.Introspection.get_methods_with_docstrings
— Methodget_methods_with_docstrings(obj::Union{Union, DataType, Function})
Get the docstring for each method for an object (function/datatype).
Term.Introspection.inspect
— Methodinspect(T::DataType; documentation::Bool=false, constructors::Bool=true, methods::Bool=true, supertypes::Bool=true)
Inspect a DataType
to show info such as docstring, constructors and methods. Flags can be used to choose the level of detail in the information presented:
- documentation: show docstring with
termshow
- constructors: show
T
constructors - methods: show methods using
T
in their signature - supertypes: show methods using
T
's supertypes in their signature
Term.Introspection.typestree
— Methodtypestree(T)
typestree(io::IO, T)
Print the type hierarchy for T
in a pretty format. This is done using colors, indentation and unicode for maximal readability. The output included all supertypes, and one level of subtypes.
This function is not exported, so to use it you need to use the Term.typestree
syntax, or import it manually by import Term: typestree
Example
Below is an example showing the type tree for Integer
. Note that the colors of the output are not included in this docstring.
julia> Term.typestree(Integer)
╭────────────── Types hierarchy ───╮
│ │
│ Number │
│ ━━━━━━━━ │
│ │ │
│ ├── Complex │
│ └── Real │
│ ├── Rational │
│ ├── AbstractIrrational │
│ ├── Integer │
│ │ ├── Signed │
│ │ ├── Unsigned │
│ │ └── Bool │
│ └── AbstractFloat │
│ │
╰──────────────────────────────────╯