Nest server and client in their own mods

This commit is contained in:
Lucio Franco
2019-09-06 17:52:41 -04:00
parent 9d44b02e1a
commit 8b548f2ea4
8 changed files with 77 additions and 30 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
use crate::{pb::*, test_assert, TestAssertion};
use crate::{pb::client::*, pb::*, test_assert, TestAssertion};
use futures_util::{future, stream, SinkExt, StreamExt};
use tokio::sync::mpsc;
use tonic::transport::Channel;
+4 -4
View File
@@ -1,9 +1,9 @@
use crate::pb::*;
use crate::pb::{self, *};
use std::pin::Pin;
use tonic::{Code, Request, Response, Status};
pub fn create() -> TestServiceServer<TestService> {
TestServiceServer::new(TestService {
pub fn create() -> pb::server::TestServiceServer<TestService> {
server::TestServiceServer::new(TestService {
data: String::new(),
})
}
@@ -19,7 +19,7 @@ type Stream<T> =
Pin<Box<dyn futures_core::Stream<Item = std::result::Result<T, Status>> + Send + 'static>>;
#[tonic::async_trait]
impl crate::pb::TestService for TestService {
impl pb::server::TestService for TestService {
async fn empty_call(&self, _request: Request<Empty>) -> Result<Empty> {
println!("empty_call");
Ok(Response::new(Empty {}))