single

inline fun <N : ShapeNode> GroupNode.single(): N

Returns the tree's single leaf narrowed to its concrete node type N.

The load-boundary idiom: what an externally loaded asset tree contains is unknowable at compile time, so this places the one unavoidable runtime assertion at the load site — everything downstream works on the typed leaf cast-free, style and tags riding along.

Receiver

The single-leaf tree to narrow.

Return

The leaf as N.

Type Parameters

N

The expected concrete ShapeNode type.

Throws

when the tree holds no leaf at all.

when the tree holds more than one leaf.

when the single leaf is not an N — the message names the found and expected types.