capnproto / capnproto-rust

Cap'n Proto for Rust
MIT License
2.06k stars 222 forks source link

Implement streaming #517

Closed dwrensha closed 2 months ago

dwrensha commented 2 months ago

Updates code generation for methods declared with -> stream. For Server traits, these methods have no Results parameter. For Client objects, the methods go through a new StreamingRequest object.

Twoparty RPC connections get a fixed window size that can be configured via twoparty::VatNetwork::set_window_size().

The implementation closely follows capnproto-c++. (See https://github.com/capnproto/capnproto/pull/825.) One important difference: in capnproto-c++ streaming methods are delivered one-by-one, without overlap. In Rust, overlapping method calls are less error-prone, so we don't bother with that extra built-in logic.

Adds a new example streaming that performs streaming method calls on a capability returned early via set_pipeline().