是否有所有 cfg 功能的列表? [英] Is there a list of all cfg features?

查看:30
本文介绍了是否有所有 cfg 功能的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Rust 能够在构建时检查配置,例如,#[cfg(target_os = "linux")]if cfg!(target_os = "linux") {...},其中 target_os 是一个功能.

Rust has the ability to check configuration at build time with, e.g., #[cfg(target_os = "linux")] or if cfg!(target_os = "linux") {...}, where target_os is a feature.

是否有可以在 Rust 中检查的所有(或至少是常用的)特性的列表?

Is there a list of all (or, at least, commonly used) features that can be checked in Rust?

查看有关属性的相关问题是否有详尽的标准属性列表?.

推荐答案

"参考资料的条件编译"部分有一个必须定义的配置列表(从 Rust 1.14 开始):

  • target_arch 具有如下值:
    • x86
    • x86_64
    • mips
    • powerpc
    • powerpc64
    • 手臂
    • aarch64
    • target_arch with values like:
      • x86
      • x86_64
      • mips
      • powerpc
      • powerpc64
      • arm
      • aarch64
      • 窗口
      • macos
      • ios
      • linux
      • android
      • freebsd
      • 蜻蜓
      • bitrig
      • openbsd
      • netbsd
      • unix
      • 窗口
      • gnu
      • msvc
      • musl
      • "" (空字符串)
      • gnu
      • msvc
      • musl
      • "" (empty string)
      • big
      • 32
      • 64
      • 8
      • 16
      • 32
      • 64
      • ptr
      • 苹果
      • pc
      • 未知

      这篇关于是否有所有 cfg 功能的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆