userver: ugrpc::server::Writer< Response > Class Template Reference
Loading...
Searching...
No Matches
ugrpc::server::Writer< Response > Class Template Referenceabstract

#include <userver/ugrpc/server/stream.hpp>

Detailed Description

template<class Response>
class ugrpc::server::Writer< Response >

Interface to write server's responses.

This class is not thread-safe.

If any method throws, further methods must not be called on the same stream.

Definition at line 37 of file stream.hpp.

+ Inheritance diagram for ugrpc::server::Writer< Response >:

Public Member Functions

virtual void Write (Response &&response)=0
 Write the next outgoing message.
 
virtual void Write (Response &&response, const grpc::WriteOptions &options)=0
 Write the next outgoing message.
 

Member Function Documentation

◆ Write() [1/2]

template<class Response>
virtual void ugrpc::server::Writer< Response >::Write ( Response && response)
pure virtual

Write the next outgoing message.

Parameters
responsethe next message to write
Exceptions
ugrpc::server::RpcErroron an RPC error
std::exception(internal) on error from middlewares

This method uses move-only semantics for safety:

  • Middlewares may modify responses during writes, making reuse dangerous
  • After the call, response is in moved-from state and must not be reused
  • Explicit std::move ensures ownership transfer and prevents accidental reuse

◆ Write() [2/2]

template<class Response>
virtual void ugrpc::server::Writer< Response >::Write ( Response && response,
const grpc::WriteOptions & options )
pure virtual

Write the next outgoing message.

Parameters
responsethe next message to write
optionsthe write options
Exceptions
ugrpc::server::RpcErroron an RPC error
std::exception(internal) on error from middlewares

This method uses move-only semantics for safety:

  • Middlewares may modify responses during writes, making reuse dangerous
  • After the call, response is in moved-from state and must not be reused
  • Explicit std::move ensures ownership transfer and prevents accidental reuse

The documentation for this class was generated from the following file: