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 library itself.

LazyPath

Configuration.LazyPath
pub const LazyPath = union(@This().Tag)

File

lib/std/Build/Configuration.zig:1478

Code

pub const LazyPath = union(@This().Tag) {
    source_path: SourcePath,
    relative: Relative,
    generated: Generated,

    pub const Tag = enum(u8) {
        /// A source file path relative to build root.
        source_path,
        /// Relative to the directory indicated in flags.
        relative,
        /// Path is available only after it is populated by its owning step.
        generated,
    };

    pub const Flags = packed struct(u32) {
        tag: Tag,
        _: u24 = 0,
    };

    /// An index into `extra`.
    pub const Index = enum(u32) {
        _,

        pub fn get(this: @This(), c: *const Configuration) LazyPath {
            return extraData(c, LazyPath, @backingInt(this));
        }
    };

    /// An index into `extra`, or `null`.
    pub const OptionalIndex = enum(u32) {
        none = max_u32,
        _,

        pub fn unwrap(this: @This()) ?Index {
            return switch (this) {
                .none => null,
                else => @fromBackingInt(@intCast(@backingInt(this))),
            };
        }
    };

    pub const SourcePath = struct {
        flags: @This().Flags = .{},
        owner: Package.Index,
        sub_path: String,

        pub const Flags = packed struct(u32) {
            tag: Tag = .source_path,
            _: u24 = 0,
        };
    };

    pub const Generated = struct {
        flags: @This().Flags = .{},
        index: GeneratedFileIndex,
        /// Applied after `up`.
        sub_path: String = .empty,

        pub const Flags = packed struct(u32) {
            tag: Tag = .generated,
            /// The number of parent directories to go up.
            /// 0 means the generated file itself.
            /// 1 means the directory of the generated file.
            /// 2 means the parent of that directory, and so on.
            up: u24 = 0,
        };
    };

    pub const Relative = struct {
        flags: @This().Flags,
        sub_path: String,

        pub const Flags = packed struct(u32) {
            tag: Tag = .relative,
            base: Base,
            _: u16 = 0,
        };

        pub const Base = enum(u8) {
            cwd,
            local_cache,
            global_cache,
            /// Must not be used with Relative since package index is missing.
            build_root,
            zig_exe,
            zig_lib,
            install_prefix,
            install_lib,
            install_bin,
            install_include,
        };
    };
}