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. Public Union

HeaderInstallation

Public Union
std.Build.Step.Compile.HeaderInstallation
pub const HeaderInstallation = union(enum)

Fields

file: File
directory: Directory

Structs

Functions

pub fn getSource(installation: HeaderInstallation) LazyPath
pub fn dupe(installation: HeaderInstallation, graph: *const std.Build.Graph) HeaderInstallation

File

Build/Step/Compile.zig:302
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
pub const HeaderInstallation = union(enum) {
    file: File,
    directory: Directory,

    pub const File = struct {
        source: LazyPath,
        dest_rel_path: []const u8,

        pub fn dupe(file: File, graph: *const std.Build.Graph) File {
            return .{
                .source = file.source.dupe(graph),
                .dest_rel_path = graph.dupePath(file.dest_rel_path),
            };
        }
    };

    pub const Directory = struct {
        source: LazyPath,
        dest_rel_path: []const u8,
        options: Directory.Options,

        pub const Options = struct {
            /// File paths that end in any of these suffixes will be excluded from installation.
            exclude_extensions: []const []const u8 = &.{},
            /// Only file paths that end in any of these suffixes will be included in installation.
            /// `null` means that all suffixes will be included.
            /// `exclude_extensions` takes precedence over `include_extensions`.
            include_extensions: ?[]const []const u8 = &.{".h"},

            pub fn dupe(opts: Directory.Options, graph: *const std.Build.Graph) Directory.Options {
                return .{
                    .exclude_extensions = graph.dupeStrings(opts.exclude_extensions),
                    .include_extensions = if (opts.include_extensions) |incs| graph.dupeStrings(incs) else null,
                };
            }
        };

        pub fn dupe(dir: Directory, graph: *const std.Build.Graph) Directory {
            return .{
                .source = dir.source.dupe(graph),
                .dest_rel_path = graph.dupePath(dir.dest_rel_path),
                .options = dir.options.dupe(graph),
            };
        }
    };

    pub fn getSource(installation: HeaderInstallation) LazyPath {
        return switch (installation) {
            inline .file, .directory => |x| x.source,
        };
    }

    pub fn dupe(installation: HeaderInstallation, graph: *const std.Build.Graph) HeaderInstallation {
        return switch (installation) {
            .file => |f| .{ .file = f.dupe(graph) },
            .directory => |d| .{ .directory = d.dupe(graph) },
        };
    }
}