feat(tonic): Use NamedService without transport feature (#1273)

This commit is contained in:
tottoto
2023-02-15 23:47:28 +09:00
committed by GitHub
parent b712df608f
commit 5acde56176
4 changed files with 8 additions and 7 deletions
+2 -3
View File
@@ -189,10 +189,9 @@ where
}
// required to use `InterceptedService` with `Router`
#[cfg(feature = "transport")]
impl<S, F> crate::transport::NamedService for InterceptedService<S, F>
impl<S, F> crate::server::NamedService for InterceptedService<S, F>
where
S: crate::transport::NamedService,
S: crate::server::NamedService,
{
const NAME: &'static str = S::NAME;
}
+4 -2
View File
@@ -63,7 +63,7 @@
//! # unimplemented!()
//! # }
//! # }
//! # impl tonic::transport::NamedService for Svc {
//! # impl tonic::server::NamedService for Svc {
//! # const NAME: &'static str = "some_svc";
//! # }
//! # let my_svc = Svc;
@@ -99,10 +99,12 @@ mod tls;
pub use self::channel::{Channel, Endpoint};
pub use self::error::Error;
#[doc(inline)]
pub use self::server::{NamedService, Server};
pub use self::server::Server;
#[doc(inline)]
pub use self::service::grpc_timeout::TimeoutExpired;
pub use self::tls::Certificate;
#[doc(inline)]
pub use crate::server::NamedService;
pub use hyper::{Body, Uri};
pub(crate) use self::service::executor::Executor;
+1 -1
View File
@@ -142,7 +142,7 @@ impl TcpIncoming {
/// ```no_run
/// # use tower_service::Service;
/// # use http::{request::Request, response::Response};
/// # use tonic::{body::BoxBody, transport::{Body, NamedService, Server, server::TcpIncoming}};
/// # use tonic::{body::BoxBody, server::NamedService, transport::{Body, Server, server::TcpIncoming}};
/// # use core::convert::Infallible;
/// # use std::error::Error;
/// # fn main() { } // Cannot have type parameters, hence instead define:
+1 -1
View File
@@ -1,6 +1,6 @@
use crate::{
body::{boxed, BoxBody},
transport::NamedService,
server::NamedService,
};
use http::{Request, Response};
use hyper::Body;