pub fn target_triple() -> crate::Result<String> {
  let arch = if cfg!(target_arch = "x86") {
    "i686"
  } else if cfg!(target_arch = "x86_64") {
    "x86_64"
  } else if cfg!(target_arch = "arm") {
    "armv7"
  } else {
    return Err(crate::Error::Architecture);
  };

  let os = if cfg!(target_os = "linux") {
    "unknown-linux"
  } else if cfg!(target_os = "macos") {
    "apple-darwin"
  } else if cfg!(target_os = "windows") {
    "pc-windows"
  } else if cfg!(target_os = "freebsd") {
    "unknown-freebsd"
  } else {
    return Err(crate::Error::OS);
  };

  let os = if cfg!(target_os = "macos") || cfg!(target_os = "freebsd") {
    String::from(os)
  } else {
    let env = if cfg!(target_env = "gnu") {
      "gnu"
    } else if cfg!(target_env = "musl") {
      "musl"
    } else if cfg!(target_env = "msvc") {
      "msvc"
    } else {
      return Err(crate::Error::Environment);
    };

    format!("{}-{}", os, env)
  };

  Ok(format!("{}-{}", arch, os))
}
/// Try to determine the current target triple.
///
/// Returns a target triple (e.g. `x86_64-unknown-linux-gnu` or `i686-pc-windows-msvc`) or an
/// `Error::Config` if the current config cannot be determined or is not some combination of the
/// following values:
/// `linux, mac, windows` -- `i686, x86, armv7` -- `gnu, musl, msvc`
///
/// * Errors:
///     * Unexpected system config
Try to determine the current target triple.

Unexpected system config
Try to determine the current target triple . Unexpected system config
pub fn target_triple() -> crate::Result<String> {
  let arch = if cfg!(target_arch = "x86") {
    "i686"
  } else if cfg!(target_arch = "x86_64") {
    "x86_64"
  } else if cfg!(target_arch = "arm") {
    "armv7"
  } else {
    return Err(crate::Error::Architecture);
  };
  let os = if cfg!(target_os = "linux") {
    "unknown-linux"
  } else if cfg!(target_os = "macos") {
    "apple-darwin"
  } else if cfg!(target_os = "windows") {
    "pc-windows"
  } else if cfg!(target_os = "freebsd") {
    "unknown-freebsd"
  } else {
    return Err(crate::Error::OS);
  };
  let os = if cfg!(target_os = "macos") || cfg!(target_os = "freebsd") {
    String::from(os)
  } else {
    let env = if cfg!(target_env = "gnu") {
      "gnu"
    } else if cfg!(target_env = "musl") {
      "musl"
    } else if cfg!(target_env = "msvc") {
      "msvc"
    } else {
      return Err(crate::Error::Environment);
    };
    format!("{}-{}", os, env)
  };
  Ok(format!("{}-{}", arch, os))
}
pub fn target_triple ( ) -> crate :: Result < String > { let arch = if cfg ! ( target_arch " " ) { " " } else if cfg ! ( target_arch " " ) { " " } else if cfg ! ( target_arch " " ) { " " } else { return Err ( crate :: Error :: Architecture ) ; } ; let os = if cfg ! ( target_os " " ) { " " } else if cfg ! ( target_os " " ) { " " } else if cfg ! ( target_os " " ) { " " } else if cfg ! ( target_os " " ) { " " } else { return Err ( crate :: Error :: OS ) ; } ; let os = if cfg ! ( target_os " " ) || cfg ! ( target_os " " ) { String :: from ( os ) } else { let env = if cfg ! ( target_env " " ) { " " } else if cfg ! ( target_env " " ) { " " } else if cfg ! ( target_env " " ) { " " } else { return Err ( crate :: Error :: Environment ) ; } ; format ! ( " " os env ) } ; Ok ( format ! ( " " arch os ) ) }
Try to determine the current target triple.
Try to determine the current target triple .