Add examples

This commit is contained in:
Igor Katson 2023-11-19 22:48:19 +00:00
parent adb98a2d89
commit 2ebbc0a828
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
9 changed files with 541 additions and 30 deletions

View file

@ -38,3 +38,14 @@ impl BlockingSpawner {
f()
}
}
impl Default for BlockingSpawner {
fn default() -> Self {
let allow_block_in_place = match tokio::runtime::Handle::current().runtime_flavor() {
tokio::runtime::RuntimeFlavor::CurrentThread => false,
tokio::runtime::RuntimeFlavor::MultiThread => true,
_ => true,
};
Self::new(allow_block_in_place)
}
}