#target-triple #triple #target #host #install #package

guess_host_triple

Guess which Rust-supported platform is running the current code

5 releases

Uses old Rust 2015

0.1.4 Aug 24, 2024
0.1.3 Sep 22, 2021
0.1.2 Apr 1, 2020
0.1.1 Mar 26, 2020
0.1.0 Apr 25, 2018

#142 in Operating systems

Download history 5860/week @ 2024-06-27 4702/week @ 2024-07-04 6219/week @ 2024-07-11 6072/week @ 2024-07-18 7411/week @ 2024-07-25 6634/week @ 2024-08-01 7639/week @ 2024-08-08 5878/week @ 2024-08-15 8272/week @ 2024-08-22 7864/week @ 2024-08-29 9720/week @ 2024-09-05 8650/week @ 2024-09-12 7339/week @ 2024-09-19 8554/week @ 2024-09-26 8655/week @ 2024-10-03 7248/week @ 2024-10-10

33,217 downloads per month
Used in 13 crates (6 directly)

MIT/Apache

28KB
652 lines

guess_host_triple: Guess which Rust-supported platform is running the current code

Repository: https://gitlab.com/Screwtapello/guess_host_triple

Documentation: https://docs.rs/guess_host_triple


lib.rs:

Guess which Rust-supported platform is running the current code.

Introduction

In the world of compilers, for both Rust and other languages, the "host" is the computer where the compiler runs and produces an executable, and the "target" is the computer where the resulting executable runs. Usually they are the same, but they don't have to be; for example, you can use a powerful desktop computer to compile code for a tiny microcontroller that wouldn't have the resources to compile a program on its own.

For compilers that can target many different kinds of computers, each target is given a unique name according to the "target triple" convention. If we describe the computer that the compiler runs on with a "triple", that's a "host triple".

Before you can install a copy of the Rust compiler on a given computer, you need to know the host triple Rust uses to describe computer, so you can choose a compatible one. This crate provides a function that guesses the host triple for the computer that it runs on, which you can look up in the Rust release channel metadata to find the URLs of the packages you'll need to download.

The code in this crate was originally extracted from the official rustup tool.

Example

 extern crate guess_host_triple;

 guess_host_triple::guess_host_triple()
     .map(|triple| println!("This computer's triple: {}", triple))
     .unwrap_or_else(|| println!("Can't guess this computer's triple"));

 // Prints something like:
 //
 // This computer's triple: x86_64-unknown-linux-gnu

Dependencies

~61–325KB