Crates.io | close-err |
lib.rs | close-err |
version | 1.0.2 |
source | src |
created_at | 2022-03-28 21:38:34.894523 |
updated_at | 2023-03-03 08:30:01.768701 |
description | Add .close() to file-like types, for error handling |
homepage | https://github.com/bobrippling/close-err |
repository | https://github.com/bobrippling/close-err |
max_upload_size | |
id | 558179 |
size | 3,697 |
Exposes a close
method on files (and similar types), to permit finer grained error handling.
Inspired by close-file
, but more generic and works correctly on unix.
For example:
use std::{io, fs::File};
use close_err::Closable;
fn main() -> Result<(), io::Error> {
let f = File::create("hi.txt")?;
f.close()?;
Ok(())
}