@@ -516,6 +516,7 @@ immutable Unsupported <: AxisTrait end
516516
517517"""
518518 axistrait(ax::Axis) -> Type{<:AxisTrait}
519+ axistrait{T}(::Type{T}) -> Type{<:AxisTrait}
519520
520521Returns the indexing type of an `Axis`, any subtype of `AxisTrait`.
521522The default is `Unsupported`, meaning there is no special indexing behaviour for this axis
@@ -528,13 +529,16 @@ User-defined axis types can be added along with custom indexing behaviors by def
528529methods of this function. Here is the example of adding a custom Dimensional axis:
529530
530531```julia
531- AxisArrays.axistrait(v:: MyCustomAxis) = AxisArrays.Dimensional
532+ AxisArrays.axistrait(::Type{ MyCustomAxis} ) = AxisArrays.Dimensional
532533```
533534"""
534- axistrait (:: Any ) = Unsupported
535- axistrait (ax:: Axis ) = axistrait (ax. val)
536- axistrait {T<:Union{Number, Dates.AbstractTime}} (:: AbstractVector{T} ) = Dimensional
537- axistrait {T<:Union{Symbol, AbstractString}} (:: AbstractVector{T} ) = Categorical
535+ axistrait {T} (:: T ) = axistrait (T)
536+ axistrait {T} (:: Type{T} ) = Unsupported
537+ axistrait {name, T} (:: Type{Axis{name, T}} ) = axistrait (T)
538+ axistrait {T<:AbstractVector} (:: Type{T} ) = _axistrait_el (eltype (T))
539+ _axistrait_el {T<:Union{Number, Dates.AbstractTime}} (:: Type{T} ) = Dimensional
540+ _axistrait_el {T<:Union{Symbol, AbstractString}} (:: Type{T} ) = Categorical
541+ _axistrait_el {T} (:: Type{T} ) = Unsupported
538542
539543checkaxis (ax:: Axis ) = checkaxis (ax. val)
540544checkaxis (ax) = checkaxis (axistrait (ax), ax)
0 commit comments