First, note that at present pipelining only applies to capabilities (interface references). Unfortunately, since `Field` is a struct, you cannot currently pipeline it back. You can solve this by turning Field into an interface, perhaps with a get() method that returns the original struct. Also note that using pipelining does not prevent the server from returning data to the client, but simply allows the client to avoid waiting for that to happen before sending a new request to the server incorporating the results of the previous call. However, wrapping the data in an interface with a get() method will, of course, prevent the data from being returned (unless the client calls get() explicitly).
So, let's assume you turn `Field` into a capability. Then, the following applies:
A `capnp::RemotePromise<T>` is a combination of two things:
- A `kj::Promise<capnp::Response<T>>`, used for waiting on the full response.
- A `T::Pipeline`, used for expressing pipelined requests.
You can actually decompose it into both pieces with code like:
kj::Promise<capnp::Response<FieldResults>> promise = kj::mv(remotePromise);
FieldResults::Pipeline pipeline = kj::mv(remotePromise);
In your case, it sounds like you actually only care about the pipeline part. You don't need the promise part at all -- you actually don't even need to join the promises.
In fact, `fieldRequest.send().getField()` actually returns type `Field`, not a `RemotePromise` (again, assuming `Field` is an interface type; if it were a struct, you'd get Field::Pipeline). So, you can build an Array<Field> which you can then pass into the `summarize` request. The rest of the RemotePromise can then be discarded.
-Kenton