Waiiiit, if we can return closures from functions now - creating middleware should be a lot easier: ``` fn main () { for conn in server { let timer_done = timer(); /* run server code */ timer_done(); } } ``` Maybe with Drop semantics this can be even better?
-
Show this thread
-
Whenever talking about middleware, I always think about Koa. It's cool because they allowed for pushing things up the stack, and on the way back things would unwind. I wonder what a good way might be to achieve the same semantics in Rust. I'm thinking maybe Drop, but erorrs :/
2 replies 0 retweets 1 likeShow this thread -
Replying to @yoshuawuyts
Yes, it's important that middlewares get control back once all subsequent middlewares have been executed. That was one thing that really bugged me with Express.
1 reply 0 retweets 1 like
Replying to @Jhnnns
hehe, yeah same. Just realized Rust's Gotham framework offers this btw. Pretty neat! :D
2:05 AM - 8 Jun 2018
0 replies
0 retweets
1 like
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.