triplers
Faster, safer, and more compact target triple parser than
target-lexicon— supporting every LLVM target, including the exotic ones.
triplers is a Rust library for parsing, manipulating, and serializing target triples (e.g., x86_64-unknown-linux-gnu-elf). It aims to be a drop-in replacement for target-lexicon with broader coverage, better performance, and no_std support by design.
✨ Features
- ✅ Complete LLVM coverage – supports all architectures, vendors, kernels, environments, and object formats known to LLVM (including
dxil,spirv,kalimba,ve,nvptx). - ⚡ Fast & lightweight – zero-allocation parsing, minimal code size, and optimized prefix matching.
- 🔒 Safe Rust – no
unsafe, no dependencies exceptstrum(with optionalserde). - 📦
no_stdready – works on embedded systems and kernels (disable default features). - 🎯 Round-trip canonicalization – parse any triple and regenerate the canonical string.
- 🧩 Modular design – each triple component (
Arch,Vendor,Kernel,Env,Obj) is a separate enum. - 🧪 Extensively tested – over 200 test cases, including all LLVM triples.
📦 Installation
Enable serde support:
🚀 Quick Start
use Triple;
use FromStr;
🔍 Parsing & Display
use Triple;
// Parse a full triple with object format
let t = parse.unwrap;
assert_eq!;
// Missing vendor is allowed
let t = parse.unwrap;
assert_eq!;
assert_eq!;
// Freestanding (bare-metal) triples
let t = parse.unwrap;
assert!;
// Exotic LLVM targets
let t = parse.unwrap;
assert_eq!;
🌍 Supported Target Components
Architectures (partial list)
x86, x86_64, arm (v4t … v9.7a), aarch64 (arm64, arm64e, arm64ec), mips (32/64, r6, el), powerpc (32/64, spe, el), wasm32, wasm64, spirv (1.0–1.6), dxil (1.0–1.9), kalimba (3/4/5), ve, nvptx, and more.
Vendors
unknown, apple, pc, microsoft, nvidia, intel, ibm, mesa, suse, scei, meta, kvin, freescale, imagtech, mipstech, openemb, csr, nodellvm.
Kernels / OSes
linux, windows (canonicalized to win32), freebsd, openbsd, netbsd, dragonfly, darwin, macosx, ios, tvos, watchos, visionos, bridgeos, fuchsia, solaris, illumos, hermitcore, emscripten, wasi, wasip1/p2/p3, cuda, nvcl, amdhsa, vulkan, opencl, uefi, redox, haiku, rtems, none, and many more.
Environments / ABIs
gnu, gnueabi, gnueabihf, musl, musleabi, musleabihf, android, msvc, llvm, itanium, coreclr, eabi, eabihf, plus DXIL shader stages (raygeneration, closesthit, pixel, etc.).
Object Formats
elf, macho, coff, xcoff, goff, wasm, spirv, dxcontainer.
(See the docs for the complete list.)
🛠️ Cargo Features
std(enabled by default) – disables#![no_std]crate-level attribute.serde– derivesSerialize/Deserializefor all triple components.
Disable default features for no_std environments:
[]
= false
💡 Why another target triple library?
target-lexicon is great, but it doesn't cover the full LLVM spectrum. When working with exotic architectures like Kalimba, VE, or SPIR-V, you'd hit UnknownVariant errors. triplers fills that gap by:
- Including every target component defined in LLVM's
Triple.h. - Providing canonical string representations that round-trip exactly.
- Being faster because of careful parser design and minimal dependencies.
📄 License
Licensed under MIT license ([LICENSE])(LICENSE)
🤝 Contributing
Contributions are welcome! Please open an issue or a pull request. For LLVM updates, feel free to add new target components.
Made with ❤️ for the Rust and LLVM ecosystems.