Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 6 jsonrpc_client #28

Open
simGudim opened this issue Dec 7, 2020 · 1 comment
Open

Chapter 6 jsonrpc_client #28

simGudim opened this issue Dec 7, 2020 · 1 comment

Comments

@simGudim
Copy link

simGudim commented Dec 7, 2020

Hello,

thank you for the wonder book. I was hoping that you can update chapter 6 code. Currently the jsonrpc examople doesn't work. I get the following message for the compiler:

error[E0107]: wrong number of type arguments: expected 1, found 0
  --> src/main.rs:19:13
   |
19 |     client: Client
   |             ^^^^^^ expected 1 type argument

Thanks

@neodes-h
Copy link

neodes-h commented Dec 29, 2020

Please take a look at your proto file and ring_grpc.rs file. The name of Client struct could be something else.
In my code, I defined the service to be Ring in proto file. So the struct is called RingClient.


ring.proto

syntax = "proto3";

option java_multiple_files = true;
option java_package = "rust.microservices.ring";
option java_outer_classname = "RingProto";
option objc_class_prefix = "RING";

package ringProto;

message Empty {}

service Ring {
    rpc StartRollCall (Empty) returns (Empty);
    rpc MarkItself (Empty) returns (Empty);
}

ring_grpc.rs

...
// client

pub struct RingClient {
    grpc_client: ::std::sync::Arc<::grpc::Client>,
}

...

So I have to use it like this:

...
pub mod ring_grpc;
use crate::ring_grpc::RingClient;
pub struct Remote {
    client: RingClient
}
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants