INNER CODE UNIT · Rust
drop
HemantKArya/BloomeeTunes · rust/src/api/downloader/mod.rs:609
fn drop(&mut self) {
if let Some(client) = self.http_client.take() {
// Only the last Arc holder actually drops the inner Client.
// If there are other clones alive, `drop(client)` just decrements
// the reference count — no inner runtime is touched.
if Arc::strong_count(&client) == 1 && Handle::try_current().is_ok() {
// We are the last owner *and* inside an async context.
// Move destruction off the async runtime.
std::thread::spawn(move || drop(client));
}
// else: either there are other clones (no inner drop) or we are
// not in an async context (safe to drop normally — implicit).
}
}
}