fix(build): Allow creating multiple services in the same package (#173)
BREAKING CHANGE: Build will now generate each service client and server into their own modules.
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
use crate::{pb::client::*, pb::*, test_assert, TestAssertion};
|
||||
use crate::{
|
||||
pb::testservice_client::*, pb::unimplementedservice_client::*, pb::*, test_assert,
|
||||
TestAssertion,
|
||||
};
|
||||
use futures_util::{future, stream, StreamExt};
|
||||
use tokio::sync::mpsc;
|
||||
use tonic::transport::Channel;
|
||||
|
||||
@@ -5,7 +5,8 @@ use std::pin::Pin;
|
||||
use std::time::Duration;
|
||||
use tonic::{Code, Request, Response, Status};
|
||||
|
||||
pub use pb::server::{TestServiceServer, UnimplementedServiceServer};
|
||||
pub use pb::testservice_server::TestServiceServer;
|
||||
pub use pb::unimplementedservice_server::UnimplementedServiceServer;
|
||||
|
||||
#[derive(Default, Clone)]
|
||||
pub struct TestService;
|
||||
@@ -17,7 +18,7 @@ type Stream<T> = Pin<
|
||||
>;
|
||||
|
||||
#[tonic::async_trait]
|
||||
impl pb::server::TestService for TestService {
|
||||
impl pb::testservice_server::TestService for TestService {
|
||||
async fn empty_call(&self, _request: Request<Empty>) -> Result<Empty> {
|
||||
Ok(Response::new(Empty {}))
|
||||
}
|
||||
@@ -153,7 +154,7 @@ impl pb::server::TestService for TestService {
|
||||
pub struct UnimplementedService;
|
||||
|
||||
#[tonic::async_trait]
|
||||
impl pb::server::UnimplementedService for UnimplementedService {
|
||||
impl pb::unimplementedservice_server::UnimplementedService for UnimplementedService {
|
||||
async fn unimplemented_call(&self, _req: Request<Empty>) -> Result<Empty> {
|
||||
Err(Status::unimplemented(""))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user