diff --git a/src/EnumX.jl b/src/EnumX.jl index 9310b01..a466896 100644 --- a/src/EnumX.jl +++ b/src/EnumX.jl @@ -8,6 +8,28 @@ abstract type Enum{T} <: Base.Enum{T} end @noinline panic(x) = throw(ArgumentError(x)) +""" + @enumx + +Macro for generating an enum type with instances. + +`@enumx` can be used as a drop in replacement for `@enum` from `Base`, but have several +improvements. See the [README](https://github.com/fredrikekre/EnumX.jl) or the module +docstring (`?EnumX` in the REPL) for more details. + +# Examples +```julia +julia> @enumx Fruit Apple Banana + +julia> Fruit.T +Enum type Fruit.T <: Enum{Int32} with 2 instances: + Fruit.Apple = 0 + Fruit.Banana = 1 + +julia> Fruit.Apple +Fruit.Apple = 0 +``` +""" macro enumx(args...) return enumx(__module__, Any[args...]) end