<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                Rust有一個特殊的屬性,`#[cfg]`,它允許你基于一個傳遞給編譯器的標記編譯代碼。它有兩種形式: ~~~ #[cfg(foo)] #[cfg(bar = "baz")] ~~~ 它還有一些幫助選項: ~~~ #[cfg(any(unix, windows))] #[cfg(all(unix, target_pointer_width = "32"))] #[cfg(not(foo))] ~~~ 這些選項可以任意嵌套: ~~~ #[cfg(any(not(unix), all(target_os="macos", target_arch = "powerpc")))] ~~~ 至于如何啟用和禁用這些開關,如果你使用Cargo的話,它們可以在你`Cargo.toml`中的[`[features]`部分](http://doc.crates.io/manifest.html#the-%5Bfeatures%5D-section)設置: ~~~ [features] # no features by default default = [] # The “secure-password” feature depends on the bcrypt package. secure-password = ["bcrypt"] ~~~ 當你這么做的時候,Cargo傳遞給`rustc`一個標記: ~~~ --cfg feature="${feature_name}" ~~~ 這些`cfg`標記集合會決定哪些功能被啟用,并且因此,哪些代碼會被編譯。讓我們看看這些代碼: ~~~ #[cfg(feature = "foo")] mod foo { } ~~~ 如果你用`cargo build --features "foo"`編譯,他會向`rustc`傳遞`--cfg feature="foo"`標記,并且輸出中將會包含`mod foo`。如果我們使用常規的`cargo build`編譯,則不會傳遞額外的標記,因此,(輸出)不會存在`foo`模塊。 ## cfg_attr 你也可以通過一個基于`cfg`變量的`cfg_attr`來設置另一個屬性: ~~~ #[cfg_attr(a, b)] ~~~ 如果`a`通過`cfg`屬性設置了的話這與`#[b]`相同,否則不起作用。 # cfg! `cfg!`[語法擴展](http://doc.rust-lang.org/nightly/book/compiler-plugins.html)也讓你可以在你的代碼中使用這類標記: ~~~ if cfg!(target_os = "macos") || cfg!(target_os = "ios") { println!("Think Different!"); } ~~~ 這會在編譯時被替換為一個`true`或`false`,依配置設定而定。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看