Skip to content

Clarifications about Input semantics #83

@emmatyping

Description

@emmatyping

Hi! Thank you for your work on a Rust yaml parsing crate :)

Splitting this off from #81 because I have a couple of issues that aren't to do with error handling but more questions about the semantics. For context I am trying to wrap a Reader that reads bytes which should be utf8.

The Input trait's documentation says that implementations of skip_n should "Consume the next count character[s]."

Is it also the case that I can assume that lookahead is called prior to skip* calls just like for peek? Or should I handle the case that fewer than N characters are left in the buffer and read more?

Also, regarding lookahead, would be at all possible to start allowing implementers to buffer more than count chars? I ask because right now it is hard to implement a performant Reader implementation since I have to do multiple reads to fill a buffer with count chars, but if I could buffer more than count, I could opportunistically read 4*N bytes and load as many chars as I get from that, all in a single read and buffer the incomplete bytes as well.

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