diff --git a/Cargo.lock b/Cargo.lock index 29ff71c..264d2ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -281,7 +281,7 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "nrpc" -version = "0.2.0" +version = "0.6.0" dependencies = [ "async-trait", "bytes", @@ -290,7 +290,7 @@ dependencies = [ [[package]] name = "nrpc-build" -version = "0.5.0" +version = "0.6.0" dependencies = [ "nrpc", "prettyplease 0.2.4", diff --git a/nrpc-build/Cargo.toml b/nrpc-build/Cargo.toml index 47d30dc..d324983 100644 --- a/nrpc-build/Cargo.toml +++ b/nrpc-build/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nrpc-build" -version = "0.5.0" +version = "0.6.0" edition = "2021" license = "Apache-2.0" repository = "https://github.com/NGnius/nRPC" @@ -21,4 +21,4 @@ quote = "1.0" syn = "2.0" proc-macro2 = "1.0" -nrpc = { version = "0.2", path = "../nrpc" } +nrpc = { version = "0.6", path = "../nrpc" } diff --git a/nrpc-build/src/service_gen.rs b/nrpc-build/src/service_gen.rs index 34bd056..664a504 100644 --- a/nrpc-build/src/service_gen.rs +++ b/nrpc-build/src/service_gen.rs @@ -86,7 +86,7 @@ fn trait_methods_server(descriptors: &Vec) -> proc_macro2:: } } -fn struct_methods_client(service_name: &str, descriptors: &Vec) -> proc_macro2::TokenStream { +fn struct_methods_client(package_name: &str, service_name: &str, descriptors: &Vec) -> proc_macro2::TokenStream { let mut gen_methods = Vec::with_capacity(descriptors.len()); for descriptor in descriptors { match (descriptor.client_streaming, descriptor.server_streaming) { @@ -101,7 +101,7 @@ fn struct_methods_client(service_name: &str, descriptors: &Vec Result<(), nrpc::ServiceError> { - println!("call {}/{} with data {:?}", service, method, input); + println!("call {}.{}/{} with data {:?}", package, service, method, input); // This is ok to hardcode ONLY because it's for testing Ok(helloworld::HelloReply { message: "Hello World".into(), diff --git a/nrpc/Cargo.toml b/nrpc/Cargo.toml index 72d9c42..efb3c2f 100644 --- a/nrpc/Cargo.toml +++ b/nrpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nrpc" -version = "0.2.0" +version = "0.6.0" edition = "2021" license = "Apache-2.0" repository = "https://github.com/NGnius/nRPC" diff --git a/nrpc/src/service.rs b/nrpc/src/service.rs index 6a4f9a6..9bdc7e8 100644 --- a/nrpc/src/service.rs +++ b/nrpc/src/service.rs @@ -11,6 +11,7 @@ pub trait ServerService { #[async_trait::async_trait] pub trait ClientHandler { async fn call(&mut self, + package: &str, service: &str, method: &str, input: bytes::Bytes,