| Crates.io | scope-exit |
| lib.rs | scope-exit |
| version | 0.2.0 |
| created_at | 2023-11-15 07:24:49.645593+00 |
| updated_at | 2024-01-15 11:20:49.663392+00 |
| description | The util to call procedure when exit current scope. scope exit. like defer in go. |
| homepage | |
| repository | https://github.com/shylock-hg/scope-exit |
| max_upload_size | |
| id | 1036228 |
| size | 3,379 |
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
}