Hi Sandstormers,
I'm trying to understand how to connect grains with capabilities. I've made more progress than I had expected, but I'm stuck trying to set a capability on the fulfillRequest call. Here's where I am:
The fourth paragraph says, "Your powerbox request UI should implement a picker or configuration dialog which allows the user
to specify exactly what they want your app to return. Once the user has made their choice, your
app calls SessionContext.fulfillRequest() on the user's session object, passing it a capability
that fulfills the request."
I'm using Rust and sandstorm-rust, which I don't know well. Here's what I have:
let client: hello_capnp::hello::Client = capnp_rpc::new_client(HelloImpl);
let mut req = self.session_context.fulfill_request_request();
req.get().set_cap(client);
This follows the pattern that I see in sandstorm-http-bridge.c++:
The Rust compiler is not OK with my call to set_cap(). It seems that set_cap() does not exist:
error[E0599]: no method named `set_cap` found for struct `sandstorm::grain_capnp::session_context::fulfill_request_params::Builder` in the current scope
--> src/server/bin/hello_request_view.rs:52:19
|
52 | req.get().set_cap(client);
| ^^^^^^^ help: there is an associated function with a similar name: `get_cap`
With this in mind, I have a few questions:
1. Is my Client the right thing to pass as a Capability? (I can't find a definition for :Capability in grain.capnp.)
2. How can I pass the Client if set_cap() does not exist?
Thanks for your help!
Troy