Browse Source

Add docstring to at-enumx macro, closes #2.

pull/8/head
Fredrik Ekre 3 years ago
parent
commit
4a1d9bfa92
  1. 22
      src/EnumX.jl

22
src/EnumX.jl

@ -8,6 +8,28 @@ abstract type Enum{T} <: Base.Enum{T} end @@ -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

Loading…
Cancel
Save