The QGrpcCallOptions class offers various options for fine-tuning individual RPCs. 更多...
| 头: |
#include <QGrpcCallOptions>
|
| CMake: |
find_package(Qt6 REQUIRED COMPONENTS Grpc)
target_link_libraries(mytarget PRIVATE Qt6::Grpc)
|
| Since: | Qt 6.6 |
| 在 QML: | GrpcCallOptions |
| QGrpcCallOptions () | |
| QGrpcCallOptions (const QGrpcCallOptions & other ) | |
| QGrpcCallOptions (QGrpcCallOptions && other ) | |
| ~QGrpcCallOptions () | |
| std::optional<std::chrono::milliseconds> | deadlineTimeout () const |
| QHash<QByteArray, QByteArray> | metadata () && |
| const QHash<QByteArray, QByteArray> & | metadata () const & |
| QGrpcCallOptions & | setDeadlineTimeout (std::chrono::milliseconds timeout ) |
| QGrpcCallOptions & | setMetadata (QHash<QByteArray, QByteArray> && metadata ) |
| QGrpcCallOptions & | setMetadata (const QHash<QByteArray, QByteArray> & metadata ) |
(从 6.8 起)
void
|
swap (QGrpcCallOptions & other ) |
(从 6.8 起)
QVariant
|
operator QVariant () const |
| QGrpcCallOptions & | operator= (QGrpcCallOptions && other ) |
| QGrpcCallOptions & | operator= (const QGrpcCallOptions & other ) |
(从 6.8 起)
QDebug
|
operator<< (QDebug debug , const QGrpcCallOptions & callOpts ) |
QGrpcCallOptions lets you customize individual remote procedure calls (RPCs). The generated client interface provides access points to pass the QGrpcCallOptions. These options supersede the ones set via QGrpcChannelOptions .
To configure the default options shared by RPCs, use QGrpcChannelOptions .
Sets the client metadata for a specific RPC and returns a reference to the updated object.
注意:
QGrpcHttp2Channel
transports metadata as HTTP/2 headers.
键
are case-insensitive ASCII strings. You must avoid using the internal prefixes:
:
(pseudo-header),
grpc-
,或
qtgrpc-
.
值
may be either ASCII strings or binary data. For more information, see
RFC 7540, Section 8.1.2
.
注意: Setting this field overrides the value set by QGrpcChannelOptions::setMetadata () for a specific RPC.
[noexcept]
const
QHash
<
QByteArray
,
QByteArray
> &QGrpcCallOptions::
metadata
() const &
Returns the client metadata for a specific RPC. If this field is unset, returns empty metadata.
注意:
QGrpcHttp2Channel
transports metadata as HTTP/2 headers.
键
are case-insensitive ASCII strings. You must avoid using the internal prefixes:
:
(pseudo-header),
grpc-
,或
qtgrpc-
.
值
may be either ASCII strings or binary data. For more information, see
RFC 7540, Section 8.1.2
.
Default-constructs an empty QGrpcCallOptions.
Copy-constructs a QGrpcCallOptions from other .
[noexcept]
QGrpcCallOptions::
QGrpcCallOptions
(
QGrpcCallOptions
&&
other
)
Move-constructs a new QGrpcCallOptions from other .
注意: The moved-from object other is placed in a partially-formed state, in which the only valid operations are destruction and assignment of a new value.
[noexcept]
QGrpcCallOptions::
~QGrpcCallOptions
()
销毁 QGrpcCallOptions .
[noexcept]
std::optional
<
std::chrono::milliseconds
> QGrpcCallOptions::
deadlineTimeout
() const
Returns the timeout duration that is used to calculate the deadline for a specific RPC.
If this field is unset, returns an empty
std::optional
.
另请参阅 setDeadlineTimeout ().
设置 timeout for a specific RPC and returns a reference to the updated object.
A deadline sets the limit for how long a client is willing to wait for a response from a server. The actual deadline is computed by adding the timeout to the start time of the RPC.
The deadline applies to the entire lifetime of an RPC, which includes receiving the final QGrpcStatus for a previously started call and can thus be unwanted for (long-lived) streams.
注意: Setting this field overrides the value set by QGrpcChannelOptions::setDeadline() for a specific RPC.
另请参阅 deadlineTimeout ().
[noexcept, since 6.8]
void
QGrpcCallOptions::
swap
(
QGrpcCallOptions
&
other
)
交换 other 与此对象。此操作非常快且从不失败。
该函数在 Qt 6.8 引入。
[since 6.8]
QVariant
QGrpcCallOptions::
operator QVariant
() const
构造新的 QVariant from this object.
该函数在 Qt 6.8 引入。
[noexcept]
QGrpcCallOptions
&QGrpcCallOptions::
operator=
(
QGrpcCallOptions
&&
other
)
移动赋值 other 到此 QGrpcCallOptions and returns a reference to the updated object.
注意: The moved-from object other is placed in a partially-formed state, in which the only valid operations are destruction and assignment of a new value.
赋值 other 到此 QGrpcCallOptions and returns a reference to the updated object.
[since 6.8]
QDebug
operator<<
(
QDebug
debug
, const
QGrpcCallOptions
&
callOpts
)
写入 callOpts to the specified stream debug .
该函数在 Qt 6.8 引入。