serializer::read

## `serializer::read`

Read the next buffer of serialized JSON.

### Synopsis

    string_view
    read(
        char* dest,
        std::size_t size); (1)

    template<
        std::size_t N>
    string_view
    read(
        char (&dest) [N]); (2)

### Description

This function attempts to fill the caller provided buffer starting at `dest` with up to `size` characters of the serialized JSON that represents the value. If the buffer is not large enough, multiple calls may be required.

If serialization completes during this call; that is, that all of the characters belonging to the serialized value have been written to caller-provided buffers, the function `done` will return `true`.

### Preconditions

    done() == false

### Complexity

- (1) linear in `size`.

- (2) linear in `N`.

### Exception Safety

Basic guarantee. Calls to `memory_resource::allocate` may throw.

### Template Parameters

Type | Description
--- | ---
`N` | The size of the array `dest`.

### Return Value

A `string_view` containing the characters written, which may be less than `size` or `N`.

### Parameters

Name | Description
--- | ---
`dest` | A pointer to storage to write into.
`size` | The maximum number of characters to write to the memory pointed to by `dest`.

Edit this page