-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
My previous iteration had a cuter solution: https://github.com/danneu/hunk-prev/blob/master/src/lib.rs#L70-L81
let factory = move |peer: Option<SocketAddr>| {
// Request travels from bottom to top,
// Response travels from top to bottom.
pipe!(
Root::new(pool, &config.server),
(Browse::new[&config.browse, root.as_path()]),
(Cors::new[&config.cors]),
(Compress::new[pool, &config.gzip]),
(Log::new[peer, &config.log]),
(Gate::new[])
)
};When I rewrote the server, I found it easier to figure out lifetimes when the services manually called another_service.call(req) instead of holding the next service in their struct. But I have a branch that figured it out again.
Also, ideally unused middleware simply wouldn't appear in the chain instead of no-op'ing.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels