Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › Io › Threaded › dirRenamePreserve Private Function dirRenamePreserve Doc Source Private Function std.Io.Threaded.dirRenamePreserve
fn dirRenamePreserve (
userdata : ?*anyopaque ,
old_dir : Dir ,
old_sub_path : []const u8 ,
new_dir : Dir ,
new_sub_path : []const u8 ,
) Dir .RenamePreserveError !void Params userdata : ?*anyopaque old_dir : Dir old_sub_path : []const u8 new_dir : Dir new_sub_path : []const u8 File Io/Threaded.zig: 7623
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639 fn dirRenamePreserve (
userdata : ?*anyopaque ,
old_dir : Dir ,
old_sub_path : []const u8 ,
new_dir : Dir ,
new_sub_path : []const u8 ,
) Dir .RenamePreserveError !void {
const t : *Threaded = @ptrCast (@alignCast (userdata ));
if (is_windows ) return dirRenameWindowsInner (old_dir , old_sub_path , new_dir , new_sub_path , false );
if (is_darwin ) return dirRenamePreserveDarwin (old_dir , old_sub_path , new_dir , new_sub_path );
if (native_os == .linux ) return dirRenamePreserveLinux (old_dir , old_sub_path , new_dir , new_sub_path );
// Make a hard link then delete the original.
try dirHardLink (t , old_dir , old_sub_path , new_dir , new_sub_path , .{ .follow_symlinks = false });
const prev = swapCancelProtection (t , .blocked );
defer _ = swapCancelProtection (t , prev );
dirDeleteFile (t , old_dir , old_sub_path ) catch {};
}