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 library itself.
pubfnparsePathWindows(comptimeT: type, path: []constT) WindowsPath2(T) {
constkind = getWin32PathType(T, path);
constroot = root: switch (kind) {
.drive_absolute, .drive_relative => {
constdrive_letter_len = getDriveLetter(T, path).len;
break :rootpath[0 .. drive_letter_len + @as(usize, if (kind == .drive_absolute) 2else1)];
},
.relative => path[0..0],
.local_device => path[0..4],
.root_local_device => path,
.rooted => path[0..1],
.unc_absolute => {
constunc = parseUNC(T, path);
// There may be any number of path separators between the server and the share,
// so take that into account by using pointer math to get the difference.
varroot_len = 2 + (unc.share.ptr - unc.server.ptr) + unc.share.len;
if (unc.sep_after_share) root_len += 1;
break :rootpath[0..root_len];
},
};
return .{
.kind = kind,
.root = root,
};
}