fix(tonic): Remove Sync requirement for streams (#804)
This commit is contained in:
@@ -8,7 +8,7 @@ use std::pin::Pin;
|
||||
use tonic::{metadata::MetadataValue, transport::Server, Request, Response, Status, Streaming};
|
||||
|
||||
type EchoResult<T> = Result<Response<T>, Status>;
|
||||
type ResponseStream = Pin<Box<dyn Stream<Item = Result<EchoResponse, Status>> + Send + Sync>>;
|
||||
type ResponseStream = Pin<Box<dyn Stream<Item = Result<EchoResponse, Status>> + Send>>;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct EchoServer;
|
||||
|
||||
@@ -11,7 +11,7 @@ use tonic::{transport::Server, Request, Response, Status, Streaming};
|
||||
use pb::{EchoRequest, EchoResponse};
|
||||
|
||||
type EchoResult<T> = Result<Response<T>, Status>;
|
||||
type ResponseStream = Pin<Box<dyn Stream<Item = Result<EchoResponse, Status>> + Send + Sync>>;
|
||||
type ResponseStream = Pin<Box<dyn Stream<Item = Result<EchoResponse, Status>> + Send>>;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct EchoServer {
|
||||
|
||||
@@ -35,7 +35,7 @@ use echo::{
|
||||
EchoRequest, EchoResponse,
|
||||
};
|
||||
|
||||
type ResponseStream = Pin<Box<dyn Stream<Item = Result<EchoResponse, Status>> + Send + Sync>>;
|
||||
type ResponseStream = Pin<Box<dyn Stream<Item = Result<EchoResponse, Status>> + Send>>;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct MyGreeter {}
|
||||
|
||||
@@ -11,7 +11,7 @@ use tonic::{transport::Server, Request, Response, Status, Streaming};
|
||||
use pb::{EchoRequest, EchoResponse};
|
||||
|
||||
type EchoResult<T> = Result<Response<T>, Status>;
|
||||
type ResponseStream = Pin<Box<dyn Stream<Item = Result<EchoResponse, Status>> + Send + Sync>>;
|
||||
type ResponseStream = Pin<Box<dyn Stream<Item = Result<EchoResponse, Status>> + Send>>;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct EchoServer {
|
||||
|
||||
@@ -20,7 +20,7 @@ use echo::{
|
||||
EchoRequest, EchoResponse,
|
||||
};
|
||||
|
||||
type ResponseStream = Pin<Box<dyn Stream<Item = Result<EchoResponse, Status>> + Send + Sync>>;
|
||||
type ResponseStream = Pin<Box<dyn Stream<Item = Result<EchoResponse, Status>> + Send>>;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
@@ -102,8 +102,7 @@ impl RouteGuide for RouteGuideService {
|
||||
Ok(Response::new(summary))
|
||||
}
|
||||
|
||||
type RouteChatStream =
|
||||
Pin<Box<dyn Stream<Item = Result<RouteNote, Status>> + Send + Sync + 'static>>;
|
||||
type RouteChatStream = Pin<Box<dyn Stream<Item = Result<RouteNote, Status>> + Send + 'static>>;
|
||||
|
||||
async fn route_chat(
|
||||
&self,
|
||||
|
||||
@@ -12,7 +12,7 @@ use tonic::{transport::Server, Request, Response, Status, Streaming};
|
||||
use pb::{EchoRequest, EchoResponse};
|
||||
|
||||
type EchoResult<T> = Result<Response<T>, Status>;
|
||||
type ResponseStream = Pin<Box<dyn Stream<Item = Result<EchoResponse, Status>> + Send + Sync>>;
|
||||
type ResponseStream = Pin<Box<dyn Stream<Item = Result<EchoResponse, Status>> + Send>>;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct EchoServer {}
|
||||
|
||||
@@ -14,7 +14,7 @@ use tonic::{
|
||||
};
|
||||
|
||||
type EchoResult<T> = Result<Response<T>, Status>;
|
||||
type ResponseStream = Pin<Box<dyn Stream<Item = Result<EchoResponse, Status>> + Send + Sync>>;
|
||||
type ResponseStream = Pin<Box<dyn Stream<Item = Result<EchoResponse, Status>> + Send>>;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct EchoServer;
|
||||
|
||||
@@ -9,7 +9,7 @@ use tonic::transport::{Certificate, Identity, Server, ServerTlsConfig};
|
||||
use tonic::{Request, Response, Status};
|
||||
|
||||
type EchoResult<T> = Result<Response<T>, Status>;
|
||||
type ResponseStream = Pin<Box<dyn Stream<Item = Result<EchoResponse, Status>> + Send + Sync>>;
|
||||
type ResponseStream = Pin<Box<dyn Stream<Item = Result<EchoResponse, Status>> + Send>>;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct EchoServer;
|
||||
|
||||
Reference in New Issue
Block a user