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

formatVersion

Private Function
std.Target.Query.formatVersion
fn formatVersion(version: SemanticVersion, gpa: Allocator, list: *ArrayList(u8)) !void

Formats a version with the patch component omitted if it is zero, unlike SemanticVersion.format which formats all its version components regardless.

Params

File

Target/Query.zig:413
413
414
415
416
417
418
419
fn formatVersion(version: SemanticVersion, gpa: Allocator, list: *ArrayList(u8)) !void {
    if (version.patch == 0) {
        try list.print(gpa, "{d}.{d}", .{ version.major, version.minor });
    } else {
        try list.print(gpa, "{d}.{d}.{d}", .{ version.major, version.minor, version.patch });
    }
}