en	BuffersGenerator
zh-hans	缓冲区生成器

en	A [*BuffersGenerator] provides a generalized interface for generating serialized data for sequential processing.
zh-hans	[*缓冲区生成器] 用于提供通用接口，以生成用于顺序处理的序列化数据。

en	The generator will be asked to produce buffers. The consuming code will signal how much of the data has been consumed, and repeatedly query for buffers until no more data is available, or the generator indicates an error condition.
zh-hans	该生成器将被要求生成缓冲区。调用方代码用于指示已消费的数据量，并重复查询缓冲区，直到无更多数据可用，或该生成器指示错误条件为止。

en	In this way, serializers can be adapted as [*BuffersGenerator], for example [link beast.ref.boost__beast__http__message_generator `http::message_generator`] which provides a type-erased interface for a variety of concrete http message types.
zh-hans	通过这种方式，序列化器可适配为[*缓冲区生成器]，例如[link beast.ref.boost__beast__http__message_generator `http::message_generator`] 用于为多种具体 HTTP 消息类型提供类型擦除接口。

en	Overloads of [link beast.ref.boost__beast__write `write`] and [link beast.ref.boost__beast__async_write `async_write`] operations are provided as free functions. These operations will consume the output of a [*BuffersGenerator] and process the data by writing them to a __SyncWriteStream__ or __AsyncWriteStream__ respectively.
zh-hans	[link beast.ref.boost__beast__write write] 与 [link beast.ref.boost__beast__async_write async_write] 操作以自由函数形式提供重载。这些操作用于调用 [*缓冲区生成器] 的输出，并分别将数据写入 SyncWriteStream 或 AsyncWriteStream 进行处理。

en	Associated Types
zh-hans	关联类型

en	* [link beast.ref.boost__beast__is_buffers_generator `is_buffers_generator`] * __ConstBufferSequence__

en	Requirements
zh-hans	要求

en	In this table:
zh-hans	在下表中:

en	* `G` denotes a type meeting the requirements of [*BuffersGenerator]. * `g` denotes a value of type `G`. * `c` denotes a possibly-const value of type `G`. * `n` is a value of type `std::size_t`. * `ec` is a value of type [link beast.ref.boost__beast__error_code `error_code&`].
zh-hans	- `G` 用于表示满足 [*缓冲区生成器] 要求的类型。 - `g` 用于表示类型 `G` 的值。 - `c` 用于表示类型 `G` 的可能为 const 的值。 - `n` 是类型 `std::size_t` 的值。 - `ec` 是类型 [link beast.ref.boost__beast__error_code `error_code&`] 的值。

en	Valid expressions
zh-hans	有效表达式

en	Expression
zh-hans	表达式

en	Type
zh-hans	类型

en	Semantics, Pre/Post-conditions
zh-hans	语义、前置/后置条件

en	`G::const_buffers_type`

en	A type which meets the requirements of __ConstBufferSequence__. This is the type of buffer returned by `g.prepare(ec)`.
zh-hans	满足 __ConstBufferSequence__ 要求的类型。该类型用于表示 `g.prepare(ec)` 所返回的缓冲区类型。

en	`c.is_done()`

en	`bool`
zh-hans	`bool`（布尔值）

en	Called to ask the generator for its completion status. A generator has completed when no new buffer will be produced and previously produced buffers have been fully consumed. [*Note:] The result of invoking `prepare` on `g` once it has completed is unspecified.
zh-hans	调用此函数以向生成器（generator）查询其完成状态。 当生成器不再产生新的缓冲区，且之前已产生的缓冲区已被完全消费时，即表示生成器已完成。 [*注意：] 在生成器 g 完成后，对其调用 prepare 的结果是未定义的（unspecified）。

en	`g.prepare(ec)`

en	Called to ask the generator to produce buffers containing data for processing. The returned value is the __ConstBufferSequence__ representing unconsumed data. The function will ensure that `ec.failed()` is `false` if there was no error or set to the appropriate error code if there was one. If no unconsumed data is available, this operation shall make progress to eventually reach completion. The result of invoking `prepare` after completion or encountered error(s) is defined by the generator implementation. It can not be assumed to be meaningful or safe to do so, in general. The capacity of the buffer returned is defined by the generator implementation. [*Note:] Any buffers obtained by previous calls to `prepare` are invalidated.
zh-hans	调用此函数以请求生成器生成包含待处理数据的缓冲区。 返回值为代表未消费数据的 ConstBufferSequence。 如果未发生错误，该函数将确保 ec.failed() 为 false；如果发生了错误，则将其设置为相应的错误码。 如果没有可用的未消费数据，此操作应取得进展，以最终达到完成状态。 在完成或遇到错误后调用‘prepare’的结果由生成器实现定义。通常情况下，不能假定这种调用具有意义或是安全的。 返回缓冲区的容量由生成器实现定义。 [*注意：] 此前调用‘prepare’所获得的任何缓冲区均会失效。

en	`g.consume(n)`

en	This function is called to signal that the consumer (caller) of the generator has processed part of the data returned by the previous call to `prepare`. The value of `n` indicates how much of the data processed (in bytes). When `n` exceeds the number of bytes returned from the last call to `prepare`, `consume` shall behave as if `n` was equal to that number. Remaining unconsumed data will be returned from subsequent calls to `prepare`. [*Note:] Any buffers obtained by previous calls to `prepare` are invalidated.
zh-hans	调用此函数以向生成器发出信号，表明生成器的消费者（调用者）已处理了上一次调用‘prepare’所返回的部分数据。 n 的值表示已处理的数据量（以字节为单位）。 当 n 超过上一次调用‘prepare’返回的字节数时，‘consume’ 的行为应如同 n 等于该字节数一样。 剩余的未消费数据将在后续调用‘prepare’时返回。 [*注意：] 此前调用‘prepare’所获得的任何缓冲区均会失效。

en	`is_buffers_generator<G>`

en	`std::bool_constant`

en	An alias for `std::true_type` for `G`, otherwise an alias for `std::false_type`.
zh-hans	如果 G 满足条件，则为 std::true_type 的别名，否则为 std::false_type 的别名。

en	Exemplar
zh-hans	示例

en	```

en	```

en	Models
zh-hans	模型

en	* [link beast.ref.boost__beast__http__message_generator `http::message_generator`]

en	Algorithms
zh-hans	算法

en	* [link beast.ref.boost__beast__async_write `async_write`] * [link beast.ref.boost__beast__write `write`]