The constructor Server::new does not restrict the type parameter for the executor, so it can be used with any mistakenly used argument in that position, e.g., with a reactor::Handle from crate tokio (an easy mistake to make, since the examples use the reactor handle from tokio-core which does implement Executor).
This then results in daunting compiler error messages down the road when a Connection accepted by the server is used. When the user-provided types are generated for tower-grpc, it requires some sleuthing work to track back to what is at fault here:
no method named map_err found for type tower_h2::server::Connection<tokio::net::TcpStream, my_proto::server::NodeServer<MyGrpcServer>, tokio::reactor::Handle, my_proto::server::node::ResponseBody<MyGrpcServer>, ()> in the current scope
note: the method `map_err` exists but the following trait bounds were not satisfied:
`tower_h2::server::Connection<tokio::net::TcpStream, my_proto::server::NodeServer<MyGrpcServer>, tokio::reactor::Handle, my_proto::server::node::ResponseBody<MyGrpcServer>, ()> : futures::Future`
`&mut tower_h2::server::Connection<tokio::net::TcpStream, my_proto::server::NodeServer<MyGrpcServer>, tokio::reactor::Handle, my_proto::server::node::ResponseBody<MyGrpcServer>, ()> : futures::Future`
`&mut tower_h2::server::Connection<tokio::net::TcpStream, my_proto::server::NodeServer<MyGrpcServer>, tokio::reactor::Handle, my_proto::server::node::ResponseBody<MyGrpcServer>, ()> : futures::Stream` [E0599]
The constructor
Server::new
does not restrict the type parameter for the executor, so it can be used with any mistakenly used argument in that position, e.g., with areactor::Handle
from cratetokio
(an easy mistake to make, since the examples use the reactor handle fromtokio-core
which does implementExecutor
). This then results in daunting compiler error messages down the road when aConnection
accepted by the server is used. When the user-provided types are generated for tower-grpc, it requires some sleuthing work to track back to what is at fault here: