pub fn layer<NewLayer>(self, new_layer: NewLayer) -> Server<Stack<NewLayer, L>> {
        Server {
            service_builder: self.service_builder.layer(new_layer),
            trace_interceptor: self.trace_interceptor,
            concurrency_limit: self.concurrency_limit,
            load_shed: self.load_shed,
            timeout: self.timeout,
            #[cfg(feature = "_tls-any")]
            tls: self.tls,
            init_stream_window_size: self.init_stream_window_size,
            init_connection_window_size: self.init_connection_window_size,
            max_concurrent_streams: self.max_concurrent_streams,
            tcp_keepalive: self.tcp_keepalive,
            tcp_nodelay: self.tcp_nodelay,
            http2_keepalive_interval: self.http2_keepalive_interval,
            http2_keepalive_timeout: self.http2_keepalive_timeout,
            http2_adaptive_window: self.http2_adaptive_window,
            http2_max_pending_accept_reset_streams: self.http2_max_pending_accept_reset_streams,
            http2_max_header_list_size: self.http2_max_header_list_size,
            max_frame_size: self.max_frame_size,
            accept_http1: self.accept_http1,
            max_connection_age: self.max_connection_age,
        }
    }
Set the [Tower] [`Layer`] all services will be wrapped in.

This enables using middleware from the [Tower ecosystem][eco].

# Example

```
# use tonic::transport::Server;
# use tower_service::Service;
use tower::timeout::TimeoutLayer;
use std::time::Duration;

# let mut builder = Server::builder();
builder.layer(TimeoutLayer::new(Duration::from_secs(30)));
```

Note that timeouts should be set using [`Server::timeout`]. `TimeoutLayer` is only used
here as an example.

You can build more complex layers using [`ServiceBuilder`]. Those layers can include
[interceptors]:

```
# use tonic::transport::Server;
# use tower_service::Service;
use tower::ServiceBuilder;
use std::time::Duration;
use tonic::{Request, Status, service::InterceptorLayer};

fn auth_interceptor(request: Request<()>) -> Result<Request<()>, Status> {
if valid_credentials(&request) {
Ok(request)
} else {
Err(Status::unauthenticated("invalid credentials"))
}
}

fn valid_credentials(request: &Request<()>) -> bool {
// ...
# true
}

fn some_other_interceptor(request: Request<()>) -> Result<Request<()>, Status> {
Ok(request)
}

let layer = ServiceBuilder::new()
.load_shed()
.timeout(Duration::from_secs(30))
.layer(InterceptorLayer::new(auth_interceptor))
.layer(InterceptorLayer::new(some_other_interceptor))
.into_inner();

Server::builder().layer(layer);
```

[Tower]: https://github.com/tower-rs/tower
[`Layer`]: tower::layer::Layer
[eco]: https://github.com/tower-rs
[`ServiceBuilder`]: tower::ServiceBuilder
[interceptors]: crate::service::Interceptor
tonic/src/transport/server/mod.rs