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 › dirSymLink Private Function dirSymLink Doc Source Private Function std.Io.Dispatch.dirSymLink
fn dirSymLink (
userdata : ?*anyopaque ,
dir : Dir ,
target_path : []const u8 ,
sym_link_path : []const u8 ,
flags : Dir .SymLinkFlags ,
) Dir .SymLinkError !void Params userdata : ?*anyopaque dir : Dir target_path : []const u8 sym_link_path : []const u8 flags : Dir .SymLinkFlags File Io/Dispatch.zig: 3004
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041 fn dirSymLink (
userdata : ?*anyopaque ,
dir : Dir ,
target_path : []const u8 ,
sym_link_path : []const u8 ,
flags : Dir .SymLinkFlags ,
) Dir .SymLinkError !void {
const ev : *Evented = @ptrCast (@alignCast (userdata ));
_ = ev ;
_ = flags ;
var target_path_buffer : [c .PATH_MAX ]u8 = undefined ;
var sym_link_path_buffer : [c .PATH_MAX ]u8 = undefined ;
const target_path_posix = try pathToPosix (target_path , &target_path_buffer );
const sym_link_path_posix = try pathToPosix (sym_link_path , &sym_link_path_buffer );
while (true ) switch (c .errno (c .symlinkat (target_path_posix , dir .handle , sym_link_path_posix ))) {
.SUCCESS => return ,
.INTR => {},
.FAULT => |err | return errnoBug (err ),
.INVAL => |err | return errnoBug (err ),
.ACCES => return error .AccessDenied ,
.PERM => return error .PermissionDenied ,
.DQUOT => return error .DiskQuota ,
.EXIST => return error .PathAlreadyExists ,
.IO => return error .FileSystem ,
.LOOP => return error .SymLinkLoop ,
.NAMETOOLONG => return error .NameTooLong ,
.NOENT => return error .FileNotFound ,
.NOTDIR => return error .NotDir ,
.NOMEM => return error .SystemResources ,
.NOSPC => return error .NoSpaceLeft ,
.ROFS => return error .ReadOnlyFileSystem ,
.ILSEQ => return error .BadPathName ,
else => |err | return unexpectedErrno (err ),
};
}