Function deinit [src]

Always call deinit, even after a successful finish().

Prototype

pub fn deinit(af: *AtomicFile) void

Parameters

af: *AtomicFile

Source

pub fn deinit(af: *AtomicFile) void { if (af.file_open) { af.file_writer.file.close(); af.file_open = false; } if (af.file_exists) { const tmp_sub_path = std.fmt.hex(af.random_integer); af.dir.deleteFile(&tmp_sub_path) catch {}; af.file_exists = false; } if (af.close_dir_on_deinit) { af.dir.close(); } af.* = undefined; }