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

parseCpuArch

Public Function
std.Target.Query.parseCpuArch
pub fn parseCpuArch(args: ParseOptions) ?Target.Cpu.Arch

Similar to parse except instead of fully parsing, it only determines the CPU architecture and returns it if it can be determined, and returns null otherwise. This is intended to be used if the API user of Query needs to learn the target CPU architecture in order to fully populate ParseOptions.

Params

File

Target/Query.zig:329
329
330
331
332
333
334
335
336
337
338
pub fn parseCpuArch(args: ParseOptions) ?Target.Cpu.Arch {
    var it = mem.splitScalar(u8, args.arch_os_abi, '-');
    const arch_name = it.first();
    const arch_is_native = mem.eql(u8, arch_name, "native");
    if (arch_is_native) {
        return builtin.cpu.arch;
    } else {
        return std.meta.stringToEnum(Target.Cpu.Arch, arch_name);
    }
}