#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

#145 in Operating systems

Download history 8318/week @ 2024-08-23 8010/week @ 2024-08-30 9717/week @ 2024-09-06 7972/week @ 2024-09-13 8091/week @ 2024-09-20 8515/week @ 2024-09-27 9051/week @ 2024-10-04 8088/week @ 2024-10-11 9991/week @ 2024-10-18 7580/week @ 2024-10-25 8175/week @ 2024-11-01 8634/week @ 2024-11-08 7033/week @ 2024-11-15 7677/week @ 2024-11-22 8037/week @ 2024-11-29 6018/week @ 2024-12-06

29,868 downloads per month
Used in 14 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–320KB