2 unstable releases
0.2.0 | Jan 15, 2024 |
---|---|
0.1.0 | Nov 15, 2023 |
#1140 in Rust patterns
23 downloads per month
4KB
76 lines
Scope Exit utils
Will call closure when leave current scope. Useful to release some resource got from FFI.
e.g. Call c file API
fn test() {
let fp = fopen("test.txt");
scope_exit!(fclose(fp));
// will call `fclose` by RAII
}