peek
Deprecated (with error)
Use an explicit iterator()
Returns the current child or null
, if there are no children left (useful when iterating over this structure's children).
Migration Examples:
Using decodeRethrowing
:
structure.decodeRethrowing {
val decodedChild = peek()?.let {
// Inspect or conditionally consume the child
val child = next()
// ...
}
DecodedStructure(...)
}
Content copied to clipboard
Manual iteration:
val iterator = structure.iterator()
val child = iterator.peek()
if (child != null) {
// Inspect child without consuming it
}
Content copied to clipboard