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 › Dispatch › dirCreateFileAtomic Private Function dirCreateFileAtomic Doc Source Private Function std.Io.Dispatch.dirCreateFileAtomic
fn dirCreateFileAtomic (
userdata : ?*anyopaque ,
dir : Dir ,
dest_path : []const u8 ,
options : Dir .CreateFileAtomicOptions ,
) Dir .CreateFileAtomicError !File .Atomic Params userdata : ?*anyopaque dir : Dir dest_path : []const u8 options : Dir .CreateFileAtomicOptions File Io/Dispatch.zig: 2534
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563 fn dirCreateFileAtomic (
userdata : ?*anyopaque ,
dir : Dir ,
dest_path : []const u8 ,
options : Dir .CreateFileAtomicOptions ,
) Dir .CreateFileAtomicError !File .Atomic {
const ev : *Evented = @ptrCast (@alignCast (userdata ));
if (Dir .path .dirname (dest_path )) |dirname | {
const new_dir = if (options .make_path )
dirCreateDirPathOpen (ev , dir , dirname , .default_dir , .{}) catch |err | switch (err ) {
// None of these make sense in this context.
error .IsDir ,
error .Streaming ,
error .DiskQuota ,
error .PathAlreadyExists ,
error .LinkQuotaExceeded ,
error .PipeBusy ,
error .FileTooBig ,
error .FileLocksUnsupported ,
error .DeviceBusy ,
=> return error .Unexpected ,
else => |e | return e ,
}
else
try dirOpenDir (ev , dir , dirname , .{});
return ev .atomicFileInit (Dir .path .basename (dest_path ), options .permissions , new_dir , true );
}
return ev .atomicFileInit (dest_path , options .permissions , dir , false );
}