QGrpcCallOptions Class
The QGrpcCallOptions class offers various options for fine-tuning individual RPCs. More...
| Header: | #include <QGrpcCallOptions> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Grpc)target_link_libraries(mytarget PRIVATE Qt6::Grpc) |
| Since: | Qt 6.6 |
| In QML: | GrpcCallOptions |
QGrpcCallOptions Comparisons
| Category | Comparable Types |
|---|---|
| equality | QGrpcCallOptions |
Public Functions
| QGrpcCallOptions(QGrpcCallOptions &&other) | |
| ~QGrpcCallOptions() | |
(since 6.8) void | swap(QGrpcCallOptions &other) |
| QGrpcCallOptions & | operator=(QGrpcCallOptions &&other) |
Detailed Description
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.
QGrpcCallOptions callOpts;
// Set the metadata for an individial RPC
callOpts.setMetadata({
{ "header" , "value1" },
{ "header" , "value2" },
});
const auto &md = callOpts.metadata(QtGrpc::MultiValue);
qDebug() << "Call Metadata: " << md;
// Set a 2-second deadline for an individial RPC
callOpts.setDeadlineTimeout(2s);
qDebug() << "Call timeout: " << callOpts.deadlineTimeout();
Member Function Documentation
[constexpr noexcept default] QGrpcCallOptions::QGrpcCallOptions(QGrpcCallOptions &&other)
Move-constructs a new QGrpcCallOptions from other.
Note: 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()
Destroys the QGrpcCallOptions.
[noexcept, since 6.8] void QGrpcCallOptions::swap(QGrpcCallOptions &other)
Swaps other with this object. This operation is very fast and never fails.
This function was introduced in Qt 6.8.
[implicit] QGrpcCallOptions &QGrpcCallOptions::operator=(QGrpcCallOptions &&other)
Move-assigns other to this QGrpcCallOptions and returns a reference to the updated object.
Note: 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.