blob: 1729599f7b3f3bcec904f0cadb1048a7a0db0863 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
//@ edition:2021
#![feature(async_drop)]
#![allow(incomplete_features)]
pub struct HasDrop;
impl Drop for HasDrop{
fn drop(&mut self) {
println!("Sync drop");
}
}
pub struct MongoDrop;
impl MongoDrop {
pub async fn new() -> Result<Self, HasDrop> {
Ok(Self)
}
}
impl Drop for MongoDrop{
fn drop(&mut self) {
println!("Sync drop");
}
}
impl std::future::AsyncDrop for MongoDrop {
async fn drop(self: std::pin::Pin<&mut Self>) {
println!("Async drop");
}
}
|