scope-exit

Crates.ioscope-exit
lib.rsscope-exit
version0.2.0
sourcesrc
created_at2023-11-15 07:24:49.645593
updated_at2024-01-15 11:20:49.663392
descriptionThe util to call procedure when exit current scope. scope exit. like defer in go.
homepage
repositoryhttps://github.com/shylock-hg/scope-exit
max_upload_size
id1036228
size3,379
shylock (Shylock-Hg)

documentation

README

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
}
Commit count: 5

cargo fmt