mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-08 21:28:33 +00:00
29 lines
521 B
Rust
29 lines
521 B
Rust
//@ 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");
|
|
}
|
|
}
|