Skip to content

Decoder could do with a PeekUint8, or a way to see the unconsumed slice #11

@gdamore

Description

@gdamore

I am working on a decoder where I want to look at a code to discriminate the next type of object (high level Go object, not the low level primitive types that this library supports.)

Btw, this could also be true if I wanted to (for example) discriminate between different types based on a map key (as an example).

The simplest thing might be simply allow a consumer to get the remaining (unconsumed) byte slice. Then scratch slices could be used for any lookahead processing, while allowing the caller to go "back" to an earlier point in time in the parse.

(Another option would be to provide a Clone() method to make a deep copy of the Decoder structure.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions