@@ -516,6 +516,7 @@ immutable Unsupported <: AxisTrait end
516
516
517
517
"""
518
518
axistrait(ax::Axis) -> Type{<:AxisTrait}
519
+ axistrait{T}(::Type{T}) -> Type{<:AxisTrait}
519
520
520
521
Returns the indexing type of an `Axis`, any subtype of `AxisTrait`.
521
522
The 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
528
529
methods of this function. Here is the example of adding a custom Dimensional axis:
529
530
530
531
```julia
531
- AxisArrays.axistrait(v:: MyCustomAxis) = AxisArrays.Dimensional
532
+ AxisArrays.axistrait(::Type{ MyCustomAxis} ) = AxisArrays.Dimensional
532
533
```
533
534
"""
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
538
542
539
543
checkaxis (ax:: Axis ) = checkaxis (ax. val)
540
544
checkaxis (ax) = checkaxis (axistrait (ax), ax)
0 commit comments