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.
Function parameters
Parameters
Type definitions in this namespace
Types
Functions in this namespace
Functions
- parseCpuArch
- Similar to `parse` except instead of fully parsing, it only determines the CPU
- parseVersion
- Similar to `SemanticVersion.parse`, but with following changes:
- serializeCpu
- Renders the query into a textual representation that can be parsed via the
Source
Implementation
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);
}
}