Skip to content

glz::reader/glz::writer for incremental reading/writing #1019

@stephenberry

Description

@stephenberry

Glaze doesn't easily support incremental reading and writing. There are times when we want to just parse the first element of an array, perform logic in our program, and then decide how what item to use to parse the rest of the array. This is common for formats that need header information.

Another use case is appending data to a buffer incrementally.

This issue proposes the addition of two stateful classes: gz::reader and glz::writer, which will enable incremental reading/writing.

Initially this will focus on array support, but object support will be considered in the design.

Example syntax:

glz::reader reader{buffer};
reader.read(glz::element<0>(value));
reader.read(glz::rest(value));
glz::writer writer{buffer};
writer.append(value);
write.append(value);

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions