/rust/registry/src/index.crates.io-1949cf8c6b5b557f/tower-layer-0.3.3/src/identity.rs
Line | Count | Source |
1 | | use super::Layer; |
2 | | use std::fmt; |
3 | | |
4 | | /// A no-op middleware. |
5 | | /// |
6 | | /// When wrapping a [`Service`], the [`Identity`] layer returns the provided |
7 | | /// service without modifying it. |
8 | | /// |
9 | | /// [`Service`]: https://docs.rs/tower-service/latest/tower_service/trait.Service.html |
10 | | #[derive(Default, Clone)] |
11 | | pub struct Identity { |
12 | | _p: (), |
13 | | } |
14 | | |
15 | | impl Identity { |
16 | | /// Create a new [`Identity`] value |
17 | 0 | pub const fn new() -> Identity { |
18 | 0 | Identity { _p: () } |
19 | 0 | } |
20 | | } |
21 | | |
22 | | /// Decorates a [`Service`], transforming either the request or the response. |
23 | | /// |
24 | | /// [`Service`]: https://docs.rs/tower-service/latest/tower_service/trait.Service.html |
25 | | impl<S> Layer<S> for Identity { |
26 | | type Service = S; |
27 | | |
28 | 0 | fn layer(&self, inner: S) -> Self::Service { |
29 | 0 | inner |
30 | 0 | } Unexecuted instantiation: <tower_layer::identity::Identity as tower_layer::Layer<tower::util::either::Either<tower::limit::rate::service::RateLimit<tonic::transport::channel::service::reconnect::Reconnect<tonic::transport::channel::service::connection::MakeSendRequestService<tonic::transport::channel::service::connector::Connector<tonic::transport::channel::uds_connector::UdsConnector>>, http::uri::Uri>>, tonic::transport::channel::service::reconnect::Reconnect<tonic::transport::channel::service::connection::MakeSendRequestService<tonic::transport::channel::service::connector::Connector<tonic::transport::channel::uds_connector::UdsConnector>>, http::uri::Uri>>>>::layer Unexecuted instantiation: <tower_layer::identity::Identity as tower_layer::Layer<tower::util::either::Either<tower::limit::rate::service::RateLimit<tonic::transport::channel::service::reconnect::Reconnect<tonic::transport::channel::service::connection::MakeSendRequestService<tonic::transport::channel::service::connector::Connector<hyper_util::client::legacy::connect::http::HttpConnector>>, http::uri::Uri>>, tonic::transport::channel::service::reconnect::Reconnect<tonic::transport::channel::service::connection::MakeSendRequestService<tonic::transport::channel::service::connector::Connector<hyper_util::client::legacy::connect::http::HttpConnector>>, http::uri::Uri>>>>::layer Unexecuted instantiation: <tower_layer::identity::Identity as tower_layer::Layer<tonic::transport::channel::service::add_origin::AddOrigin<tonic::transport::channel::service::user_agent::UserAgent<tonic::transport::service::grpc_timeout::GrpcTimeout<tower::util::either::Either<tower::limit::concurrency::service::ConcurrencyLimit<tower::util::either::Either<tower::limit::rate::service::RateLimit<tonic::transport::channel::service::reconnect::Reconnect<tonic::transport::channel::service::connection::MakeSendRequestService<tonic::transport::channel::service::connector::Connector<tonic::transport::channel::uds_connector::UdsConnector>>, http::uri::Uri>>, tonic::transport::channel::service::reconnect::Reconnect<tonic::transport::channel::service::connection::MakeSendRequestService<tonic::transport::channel::service::connector::Connector<tonic::transport::channel::uds_connector::UdsConnector>>, http::uri::Uri>>>, tower::util::either::Either<tower::limit::rate::service::RateLimit<tonic::transport::channel::service::reconnect::Reconnect<tonic::transport::channel::service::connection::MakeSendRequestService<tonic::transport::channel::service::connector::Connector<tonic::transport::channel::uds_connector::UdsConnector>>, http::uri::Uri>>, tonic::transport::channel::service::reconnect::Reconnect<tonic::transport::channel::service::connection::MakeSendRequestService<tonic::transport::channel::service::connector::Connector<tonic::transport::channel::uds_connector::UdsConnector>>, http::uri::Uri>>>>>>>>::layer Unexecuted instantiation: <tower_layer::identity::Identity as tower_layer::Layer<tonic::transport::channel::service::add_origin::AddOrigin<tonic::transport::channel::service::user_agent::UserAgent<tonic::transport::service::grpc_timeout::GrpcTimeout<tower::util::either::Either<tower::limit::concurrency::service::ConcurrencyLimit<tower::util::either::Either<tower::limit::rate::service::RateLimit<tonic::transport::channel::service::reconnect::Reconnect<tonic::transport::channel::service::connection::MakeSendRequestService<tonic::transport::channel::service::connector::Connector<hyper_util::client::legacy::connect::http::HttpConnector>>, http::uri::Uri>>, tonic::transport::channel::service::reconnect::Reconnect<tonic::transport::channel::service::connection::MakeSendRequestService<tonic::transport::channel::service::connector::Connector<hyper_util::client::legacy::connect::http::HttpConnector>>, http::uri::Uri>>>, tower::util::either::Either<tower::limit::rate::service::RateLimit<tonic::transport::channel::service::reconnect::Reconnect<tonic::transport::channel::service::connection::MakeSendRequestService<tonic::transport::channel::service::connector::Connector<hyper_util::client::legacy::connect::http::HttpConnector>>, http::uri::Uri>>, tonic::transport::channel::service::reconnect::Reconnect<tonic::transport::channel::service::connection::MakeSendRequestService<tonic::transport::channel::service::connector::Connector<hyper_util::client::legacy::connect::http::HttpConnector>>, http::uri::Uri>>>>>>>>::layer Unexecuted instantiation: <tower_layer::identity::Identity as tower_layer::Layer<tonic::transport::channel::service::reconnect::Reconnect<tonic::transport::channel::service::connection::MakeSendRequestService<tonic::transport::channel::service::connector::Connector<tonic::transport::channel::uds_connector::UdsConnector>>, http::uri::Uri>>>::layer Unexecuted instantiation: <tower_layer::identity::Identity as tower_layer::Layer<tonic::transport::channel::service::reconnect::Reconnect<tonic::transport::channel::service::connection::MakeSendRequestService<tonic::transport::channel::service::connector::Connector<hyper_util::client::legacy::connect::http::HttpConnector>>, http::uri::Uri>>>::layer Unexecuted instantiation: <tower_layer::identity::Identity as tower_layer::Layer<_>>::layer |
31 | | } |
32 | | |
33 | | impl fmt::Debug for Identity { |
34 | 0 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
35 | 0 | f.debug_struct("Identity").finish() |
36 | 0 | } |
37 | | } |