Skip to content

der: Reader::peek_into #1475

@tarcieri

Description

@tarcieri

As I was looking at #1474, the buffering logic for PemDecoder seems quite complicated, and somewhat duplicates buffering logic already in base64ct and pem-rfc7468.

I think what would really help is if we could both push the peeking/buffering as far down the stack as possible (i.e. into base64ct where there's already a bunch of existing buffering logic), and also be able to have provided methods for peek_byte and peek_header.

I think what we could potentially do is expose a method analogous to read_into, e.g.:

fn peek_into(&mut self, buf: &'o mut [u8]) -> Result<(), Error> { ... }

This would fill the provided buffer with the next data in the reader, but not update its internal state.

With this, it would be trivial to have provided methods for peek_byte and peek_header.

Alternative to #1279.

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