#Rust / #RustLang question: I have a type that, while an instance of it exists, provides some service (e.g. a web server). The Drop implementation of that type containts its teardown logic:
fn main() {
let s = Server::new();
// … more code …
spin_until_ctrl_c();
// Teardown of s happens here implicitly
}
Now, rustc will of course complain about the unused instance. Same if I put it in a struct field or something, so the service is available as long as that object exists.
1/2