Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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. Private Function

addOptionalLazyPathEnum

Private Function
std.Build.Serialize.addOptionalLazyPathEnum
fn addOptionalLazyPathEnum(s: *Serialize, lp: ?std.Build.LazyPath) !Configuration.LazyPath.OptionalIndex

Params

File

Build/Serialize.zig:741
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
fn addOptionalLazyPathEnum(s: *Serialize, lp: ?std.Build.LazyPath) !Configuration.LazyPath.OptionalIndex {
    const wc = s.wc;
    return @fromBackingInt(@intCast(switch (lp orelse return .none) {
        .src_path => |src_path| i: {
            const sub_path = try wc.addString(src_path.sub_path);
            break :i try wc.addExtraErased(Configuration.LazyPath.SourcePath, .{
                .owner = try s.builderToPackage(src_path.owner),
                .sub_path = sub_path,
            });
        },
        .generated => |generated| i: {
            const sub_path = try wc.addString(generated.sub_path);
            break :i try wc.addExtraErased(Configuration.LazyPath.Generated, .{
                .flags = .{ .up = @intCast(generated.up) },
                .index = generated.index,
                .sub_path = sub_path,
            });
        },
        .cwd_relative => |cwd_relative_sub_path| i: {
            const sub_path = try wc.addString(cwd_relative_sub_path);
            break :i try wc.addExtraErased(Configuration.LazyPath.Relative, .{
                .flags = .{ .base = .cwd },
                .sub_path = sub_path,
            });
        },
        .relative => |relative| i: {
            break :i try wc.addExtraErased(Configuration.LazyPath.Relative, .{
                .flags = .{ .base = relative.base },
                .sub_path = try wc.addString(relative.sub_path),
            });
        },
        .dependency => |dependency| i: {
            const sub_path = try wc.addString(dependency.sub_path);
            break :i try wc.addExtraErased(Configuration.LazyPath.SourcePath, .{
                .owner = try s.builderToPackage(dependency.dependency.builder),
                .sub_path = sub_path,
            });
        },
    }));
}