How to document an enum?

What is a good way to document an enum?

I currently do this:

"""
   Model `VSM` `LLT`

Enumeration of the implemented model types.

# Elements
- VSM: Vortex Step Method
- LLT: Lifting Line Theory
"""
@enum Model VSM LLT

Is there a better way?

I do a primary docstring like you have, but also a short docstring for each variant so that ?VSM tells me what it is

@doc """
   VSM::Model

Vortex Step Method.

See also [`Model`](@ref).
""" VSM

@doc """
   LLT::Model

Lifting Line Theory.

See also [`Model`](@ref).
""" LLT
3 Likes

This is not yet working for me:

"""
    @enum ProfileLaw EXP=1 LOG=2 EXPLOG=3

Enumeration to describe the wind profile low that is used.
"""
@enum ProfileLaw begin
    EXP=1 
    LOG=2 
    EXPLOG=3 
    FAST_EXP=4 
    FAST_LOG=5 
    FAST_EXPLOG=6
end
@doc """
    EXP::ProfileLaw

Exponential wind profile.

See also [`ProfileLaw`](@ref).
"""

I get:

help?> EXP
search: EXP EXPLOG

  No documentation found for private symbol.

  EXP is of type ProfileLaw.

  Summary
  ≡≡≡≡≡≡≡

  primitive type ProfileLaw

  Supertype Hierarchy
  ≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡

  ProfileLaw <: Enum{Int32} <: Any

What am I doing wrong?

Got it, this works:

"""
    @enum ProfileLaw EXP=1 LOG=2 EXPLOG=3

Enumeration to describe the wind profile low that is used.
""" ProfileLaw

@enum ProfileLaw begin 
    EXP=1 
    LOG=2 
    EXPLOG=3 
    FAST_EXP=4 
    FAST_LOG=5 
    FAST_EXPLOG=6
end

@doc """
    EXP::ProfileLaw

Exponential wind profile.

See also [`ProfileLaw`](@ref).
""" EXP
1 Like