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

parse

Private Function
std.zig.system.linux.CpuinfoParser.parse
fn parse(arch: Target.Cpu.Arch, reader: *Io.Reader) !?Target.Cpu

Params

  • arch: Target.Cpu.Arch
  • reader: *Io.Reader

File

zig/system/linux.zig:431
431
432
433
434
435
436
437
438
439
440
        fn parse(arch: Target.Cpu.Arch, reader: *Io.Reader) !?Target.Cpu {
            var obj: impl = .{};
            while (try reader.takeDelimiter('\n')) |line| {
                const colon_pos = mem.findScalar(u8, line, ':') orelse continue;
                const key = mem.trimEnd(u8, line[0..colon_pos], " \t");
                const value = mem.trimStart(u8, line[colon_pos + 1 ..], " \t");
                if (!try obj.line_hook(key, value)) break;
            }
            return obj.finalize(arch);
        }