Last active
September 19, 2022 15:32
-
-
Save nmrshll/6489693e102fbc53a0650c32106bf796 to your computer and use it in GitHub Desktop.
Async Drop with tokio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl Drop for MyStruct { | |
fn drop(&mut self) { | |
tokio::task::block_in_place(move || { | |
tokio::runtime::Handle::current().block_on(async move { | |
// self.client.cleanup(&mut *self.db.conn().await).await; | |
}); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment