Really long type of ServiceBuilder
#1855
-
I wanted to put creation of layers into one function and pass it to VSCode tells me that type of But I'm guessing it should be something simpler on the return type. pub fn new() -> ??????????????? {
let builder = ServiceBuilder::new()
.layer(TraceLayer::new_for_http())
.layer(CompressionLayer::new())
.layer(HandleErrorLayer::new(handle_timeout_error))
.timeout(Duration::from_secs(30));
builder
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
That's just how tower works. Nothing axum do about that. I general I recommend writing fn apply_middleware(router: Router) -> Router {
...
} instead. |
Beta Was this translation helpful? Give feedback.
That's just how tower works. Nothing axum do about that.
I general I recommend writing
instead.