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

format

Public Function
std.Build.Cache.Path.format
pub fn format(self: Path, writer: *Io.Writer) Io.Writer.Error!void

Params

File

Build/Cache/Path.zig:179
179
180
181
182
183
184
185
186
187
188
189
190
pub fn format(self: Path, writer: *Io.Writer) Io.Writer.Error!void {
    if (Io.Dir.path.isAbsolute(self.sub_path)) {
        return writer.writeAll(self.sub_path);
    } else if (self.root_dir.path) |p| {
        var bufs: [3][]const u8 = .{ p, Io.Dir.path.sep_str, self.sub_path };
        return writer.writeVecAll(bufs[0..if (self.sub_path.len > 0) 3 else 1]);
    } else if (self.sub_path.len > 0) {
        return writer.writeAll(self.sub_path);
    } else {
        return writer.writeByte('.');
    }
}