Zig 0.17.0-dev (Split by item)

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 library itself.

parseCpuArch

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.

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

File

lib/std/Target/Query.zig:329

Code

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);
    }
}