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

guess_host_triple

Guess which Rust-supported platform is running the current code

4 releases

Uses old Rust 2015

0.1.3 Sep 22, 2021
0.1.2 Apr 1, 2020
0.1.1 Mar 26, 2020
0.1.0 Apr 25, 2018

#332 in Operating systems

Download history 3805/week @ 2023-12-06 3936/week @ 2023-12-13 2666/week @ 2023-12-20 4018/week @ 2023-12-27 4681/week @ 2024-01-03 5220/week @ 2024-01-10 5178/week @ 2024-01-17 4483/week @ 2024-01-24 5492/week @ 2024-01-31 5755/week @ 2024-02-07 3750/week @ 2024-02-14 4636/week @ 2024-02-21 4583/week @ 2024-02-28 4716/week @ 2024-03-06 4382/week @ 2024-03-13 4620/week @ 2024-03-20

19,128 downloads per month
Used in 13 crates (6 directly)

MIT/Apache

28KB
650 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

~62–320KB