Walk a CBOR tree, visiting each element with a visitor function.
The visitor function is called for each element in the tree, in depth-first order.
State semantics:
The visitor's returned newState propagates down to descendants of
the just-visited node only.
Sibling subtrees each receive an independent clone of the parent's
post-visit state, so accumulating mutations in one subtree never leak
into a sibling.
State changes do not propagate up: the public walk returns void.
For maps, the visitor is called with:
A 'keyvalue' element containing both key and value
The key individually (if descent wasn't stopped)
The value individually (if descent wasn't stopped)
Template: State
The type of state to pass into each visit
Param: cbor
The CBOR value to traverse
Param: initialState
Initial state value
Param: visitor
Function to call for each element
The state-cloning visitor semantics (structuredClone per subtree)
are still subject to refinement.
Walk a CBOR tree, visiting each element with a visitor function.
The visitor function is called for each element in the tree, in depth-first order. State semantics:
newStatepropagates down to descendants of the just-visited node only.walkreturnsvoid.For maps, the visitor is called with:
Template: State
The type of state to pass into each visit
Param: cbor
The CBOR value to traverse
Param: initialState
Initial state value
Param: visitor
Function to call for each element The state-cloning visitor semantics (structuredClone per subtree) are still subject to refinement.