Expand description
An implementation of the Cap’n Proto remote procedure call protocol. Includes all Level 1 features.
§Example
# Cap'n Proto schema
interface Foo {
identity @0 (x: UInt32) -> (y: UInt32);
}
ⓘ
// Rust server defining an implementation of Foo.
struct FooImpl;
impl foo::Server for FooImpl {
fn identity(&mut self,
params: foo::IdentityParams,
mut results: foo::IdentityResults)
-> Promise<(), ::capnp::Error>
{
let x = pry!(params.get()).get_x();
results.get().set_y(x);
Promise::ok(())
}
}
ⓘ
// Rust client calling a remote implementation of Foo.
let mut request = foo_client.identity_request();
request.get().set_x(123);
let promise = request.send().promise.and_then(|response| {
println!("results = {}", response.get()?.get_y());
Ok(())
});
For a more complete example, see https://github.com/capnproto/capnproto-rust/tree/master/capnp-rpc/examples/calculator
Modules§
- Code generated from rpc.capnp.
- Code generated from rpc-twoparty.capnp.
- An implementation of
VatNetwork
for the common case of a client-server connection.
Macros§
Structs§
- Collection of unwrappable capabilities.
- A
Future
that can be run to disconnect anRpcSystem
’s ConnectionState and wait for it to be closed. - A portal to objects available on the network.
Traits§
- A two-way RPC connection.
- Tracks a particular RPC stream in order to implement a flow control algorithm.
- A message received from a
VatNetwork
. - A message to be sent by a
VatNetwork
. - Network facility between vats, it determines how to form connections between vats.
Functions§
- Creates a new local RPC client of type
C
out of an object that implements a server traitS
. - Creates a
Client
from a future that resolves to aClient
. - new_
promise_ client Deprecated Converts a promise for a client into a client that queues up any calls that arrive before the promise resolves.