llvm-scratch 0.1.15

Free Standing library in Rust
Documentation
use std::fmt;

use crate::core::target_triple as tt;

#[derive(PartialEq, PartialOrd, Eq, Ord, Debug)]
pub struct TargetTriple {
    pub architecture: tt::Arch,
    pub sub: Option<tt::Sub>,
    pub vendor: tt::Vendor,
    pub sys: tt::Sys,
    pub abi: tt::ABI,
}

impl fmt::Display for TargetTriple {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match &self.sub {
            Some(sub) => write!(
                f,
                "{}{}-{}-{}-{}",
                self.architecture, sub, self.vendor, self.sys, self.abi
            ),
            None => write!(
                f,
                "{}-{}-{}-{}",
                self.architecture, self.vendor, self.sys, self.abi
            ),
        }
    }
}