To release all resources, always call deinit, even after a successful
finish.
pub fn deinit(af: *Atomic, io: Io) void
pub fn deinit(af: *Atomic, io: Io) void {
if (af.file_open) {
af.file.close(io);
af.file_open = false;
}
if (af.file_exists) {
const tmp_sub_path = std.fmt.hex(af.file_basename_hex);
af.dir.deleteFile(io, &tmp_sub_path) catch {};
af.file_exists = false;
}
if (af.close_dir_on_deinit) {
af.dir.close(io);
af.close_dir_on_deinit = false;
}
af.* = undefined;
}