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 Function

addBytesToSource

Public Function
std.Build.Step.UpdateSourceFiles.addBytesToSource
pub fn addBytesToSource(usf: *UpdateSourceFiles, contents: []const u8, sub_path: []const u8) void

Overwrites a path relative to the package root with the provided bytes.

Because it updates source files, this should not be used as part of the normal build process, but as a utility occasionally run by a developer with intent to modify source files and then commit those changes to version control.

Params

File

Build/Step/UpdateSourceFiles.zig:54
54
55
56
57
58
59
60
61
62
63
pub fn addBytesToSource(usf: *UpdateSourceFiles, contents: []const u8, sub_path: []const u8) void {
    const graph = usf.step.owner.graph;
    const wc = &graph.wip_configuration;
    const arena = graph.arena;

    usf.embeds.append(arena, .{
        .sub_path = wc.addString(sub_path) catch @panic("OOM"),
        .contents = wc.addBytes(contents) catch @panic("OOM"),
    }) catch @panic("OOM");
}