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

parseNoBraces

Public Function
std.os.windows.GUID.parseNoBraces
pub fn parseNoBraces(s: []const u8) !GUID

Params

  • s: []const u8

File

os/windows.zig:4192
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
    pub fn parseNoBraces(s: []const u8) !GUID {
        assert(s.len == 36);
        assert(s[8] == '-');
        assert(s[13] == '-');
        assert(s[18] == '-');
        assert(s[23] == '-');
        var raw1: [4]u8 = undefined;
        var raw2: [2]u8 = undefined;
        var raw3: [2]u8 = undefined;
        var raw4: [8]u8 = undefined;
        assert((try std.fmt.hexToBytes(&raw1, s[0..8])).len == raw1.len);
        assert((try std.fmt.hexToBytes(&raw2, s[9..13])).len == raw2.len);
        assert((try std.fmt.hexToBytes(&raw3, s[14..18])).len == raw3.len);
        assert((try std.fmt.hexToBytes(raw4[0..2], s[19..23])).len == 2);
        assert((try std.fmt.hexToBytes(raw4[2..8], s[24..36])).len == 6);
        return .{
            .Data1 = @byteSwap(@as(u32, @bitCast(raw1))),
            .Data2 = @byteSwap(@as(u16, @bitCast(raw2))),
            .Data3 = @byteSwap(@as(u16, @bitCast(raw3))),
            .Data4 = raw4,
        };
    }