| 1 | This is a library for managing targets for compilers and related tools. |
| 2 | |
| 3 | Currently, the main feature is support for decoding [LLVM "triples"], which |
| 4 | are strings that identify a particular target configuration. They're named |
| 5 | "triples" because historically they contained three fields, though over time |
| 6 | they've added additional fields. This library provides a `Triple` struct |
| 7 | containing enums for each of fields of a triple. `Triple` implements |
| 8 | `FromStr` and `fmt::Display` so it can be converted to and from the |
| 9 | conventional string representation of a triple. |
| 10 | |
| 11 | `Triple` also has functions for querying a triple's endianness, |
| 12 | pointer bit width, and binary format. |
| 13 | |
| 14 | And, `Triple` and the enum types have `host()` constructors, for targeting |
| 15 | the host. |
| 16 | |
| 17 | It somewhat supports reading triples currently used by `rustc` and rustup, |
| 18 | though beware that the mapping between `rustc` and LLVM triples is not |
| 19 | one-to-one. |
| 20 | |
| 21 | It does not support reading JSON target files itself. To use it with a JSON |
| 22 | target file, construct a `Triple` using the value of the "llvm-target" field. |
| 23 | |
| 24 | [LLVM "triples"]: https://clang.llvm.org/docs/CrossCompilation.html#target-triple |