Minimal async- and sync-capable defer crate with:
- ✅ async support
 - ✅ no 
unsafecode - ✅ 
no_std+alloccompatible - ✅ optional 
no_allocmode - ✅ zero dependencies
 
Inspired by defer, but designed for embedded and async contexts.
use async_defer::defer;
fn main() {
    defer!(println!("cleanup"));
    println!("work");
}use async_defer::async_scope;
async_scope!(scope, {
    scope.defer(|| async { println!("async cleanup") });
    println!("async work");
}).await;use async_defer::no_alloc::AsyncScopeNoAlloc;
fn task() -> Pin<Box<dyn Future<Output = ()> + 'static>> {
    Box::pin(async { println!("no_alloc") })
}
let mut scope = AsyncScopeNoAlloc::<2>::new();
scope.defer(task);
scope.run().await;