Skip to content

Commit b19fe40

Browse files
authored
Update traits.jl
1 parent b4dd00c commit b19fe40

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/traits.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,15 @@ SiblingLinks(tree) = SiblingLinks(typeof(tree))
9292
ChildIndexing(node)
9393
9494
A trait indicating whether the tree node `n` has children (as returned by [`children`](@ref)) which can be
95-
indexed using 1-based indexing.
95+
indexed using 1-based indexing. Options are either [`NonIndexedChildren`](@ref) (default) or [`IndexedChildren`](@ref).
96+
97+
To declare that the tree `TreeType` supports one-based indexing on the children, define
98+
```julia
99+
AbstractTrees.ChildIndexing(::Type{<:TreeType}) = AbstractTrees.IndexedChildren()
100+
```
96101
97102
If a node has the `IndexedChildren()` so must all connected nodes in the tree. Otherwise, use
98103
`NonIndexedChildren()` instead.
99-
100-
Options are either [`NonIndexedChildren`](@ref) (default) or [`IndexedChildren`](@ref).
101104
"""
102105
abstract type ChildIndexing end
103106

0 commit comments

Comments
 (0)