en	RatePolicy
zh-hans	速率策略

en	An instance of [*RatePolicy] is associated with a [link beast.ref.boost__beast__basic_stream `basic_stream`], and controls the rate at which bytes may be independently sent and received. This may be used to achieve fine-grained bandwidth management and flow control.
zh-hans	`RatePolicy` 的实例与 [link beast.ref.boost__beast__basic_stream `basic_stream`] 相关联，用于控制独立发送和接收字节的速率。这可用于实现细粒度的带宽管理和流量控制。

en	Associated Types
zh-hans	关联类型

en	* [link beast.ref.boost__beast__rate_policy_access `rate_policy_access`]

en	These requirements may undergo non-backward compatible
zh-hans	这些要求可能会发生不向后兼容的变更。

en	Requirements
zh-hans	要求

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

en	* `P` denotes a type that meets the requirements of [*RatePolicy]. * `x` denotes an xvalue of type `P` * `a` denotes a value of type `P`. * `n` denotes a value of type `std::size_t`
zh-hans	* `P` 表示一个满足 [*RatePolicy] 要求的类型。 * `x` 表示一个类型为 `P` 的将亡值（xvalue）。 * `a` 表示一个类型为 `P` 的值。 * `n` 表示一个类型为 `std::size_t` 的值。

en	Valid expressions
zh-hans	有效表达式

en	Expression
zh-hans	表达式

en	Type
zh-hans	类型

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

en	`P a(x)`

en	Requires ['MoveConstructible].
zh-hans	要求满足 ['MoveConstructible]。

en	`friend rate_policy_access`

en	The member functions required in `P` should be private. [link beast.ref.boost__beast__rate_policy_access `rate_policy_access`] must be a friend of `P` for the implementation to gain access to the required member functions.
zh-hans	`P` 中要求的成员函数应当是私有的。[link beast.ref.boost__beast__rate_policy_access `rate_policy_access`] 必须是 `P` 的友元，以便实现能够访问这些必需的成员函数。

en	`a.available_read_bytes()`

en	`std::size_t`

en	This function is called by the implementation to determine the maximum number of allowed bytes to be transferred in the next read operation. The actual number of bytes subsequently transferred may be less than this number. If the policy returns a value of zero, the read operation will asynchronously wait until the next timer interval before retrying. When the retry occurs, this function will be called again.
zh-hans	实现会调用此函数，以确定下一次读取操作允许传输的最大字节数。随后实际传输的字节数可能会小于该数值。 如果该策略返回零值，读取操作将异步等待直到下一个计时器间隔再进行重试。当重试发生时，此函数将再次被调用。

en	`a.available_write_bytes()`

en	This function is called by the implementation to determine the maximum number of allowed bytes to be transferred in the next write operation. The actual number of bytes subsequently transferred may be less than this number. If the policy returns a value of zero, the read operation will asynchronously wait until the next timer interval before retrying. When the retry occurs, this function will be called again.
zh-hans	实现会调用此函数，以确定下一次写入操作允许传输的最大字节数。随后实际传输的字节数可能会小于该数值。 如果该策略返回零值，写入操作将异步等待直到下一个计时器间隔再进行重试。当重试发生时，此函数将再次被调用。

en	`a.transfer_read_bytes(n)`

en	The implementation calls this function to inform the policy that `n` bytes were successfully transferred in the most recent read operation. The policy object may optionally use this information to calculate throughputs and/or inform the algorithm used to determine subsequently queried transfer maximums.
zh-hans	实现会调用此函数，以通知策略在最近一次读取操作中已成功传输了 `n` 个字节。策略对象可以选择性地利用此信息来计算吞吐量，和/或用于优化后续查询传输最大值时所使用的算法。

en	`a.transfer_write_bytes(n)`

en	The implementation calls this function to inform the policy that `n` bytes were successfully transferred in the most recent write operation. The policy object may optionally use this information to calculate throughputs and/or inform the algorithm used to determine subsequently queried transfer limits.
zh-hans	实现会调用此函数，以通知策略在最近一次写入操作中已成功传输了 `n` 个字节。策略对象可以选择性地利用此信息来计算吞吐量，和/或用于优化后续查询传输上限时所使用的算法。

en	`a.on_timer()`

en	The implementation calls this function every time the internal timer expires. The policy object may optionally use this opportunity to calculate elapsed time and throughput, and/or inform the algorithm used to determine subsequently queried transfer limits.
zh-hans	每当内部计时器到期时，实现都会调用此函数。策略对象可以选择性地利用此机会来计算已用时间和吞吐量，和/或用于优化后续查询传输上限时所使用的算法。

en	Exemplar
zh-hans	示例

en	Models
zh-hans	模型

en	* [link beast.ref.boost__beast__simple_rate_policy `simple_rate_policy`] * [link beast.ref.boost__beast__unlimited_rate_policy `unlimited_rate_policy`]