pw_rpc: Disable client stream end callback by default
- Supporting a client stream end callback requires ServerReader/Writer
object to store a pw::Function, which may be a significant overhead.
Many applications may not need this callback, so the callback optional
and disable it by default.
- Fail with a helpful static_assert if set_on_client_stream_end() is
called when that callback is disabled.
Change-Id: I4b27e162953534aaa024aaca9e84b12570605fc9
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/51527
Reviewed-by: Alexei Frolov <frolv@google.com>
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
diff --git a/pw_rpc/responder.cc b/pw_rpc/responder.cc
index 7761b3a..575fa3a 100644
--- a/pw_rpc/responder.cc
+++ b/pw_rpc/responder.cc
@@ -72,7 +72,10 @@
on_error_ = std::move(other.on_error_);
on_next_ = std::move(other.on_next_);
+
+#if PW_RPC_CLIENT_STREAM_END_CALLBACK
on_client_stream_end_ = std::move(other.on_client_stream_end_);
+#endif // PW_RPC_CLIENT_STREAM_END_CALLBACK
return *this;
}