Open
Description
Type
- request post from @at15
Related
Description
NOTE: The up to date note is in http://doc/github.com/at15/rust-learning/lib/warp/
I want to have a /shutdown
route that allows me to shutdown a http sever by hitting that endpoint.
However it is not that easy in Rust compared with Go (create a context/channel for cancellation, start two go routine, one blocks on server, one wait for cancel). Rust code is harder because it uses ownership instead of GC and has mutability rules.
The post will contain the following
- how to do graceful shutdown in Go
- the iterations of getting the shutdown logic working in Rust
- closure trait
Fn
,FnMut
,FnOnce
- channel (in tokio)
- passing a channel to
Fn
closure - mutex
- closure trait