<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                > **注意**:語言項通常由Rust發行版的包裝箱提供,并且它自身有一個不穩定的接口。建議使用官方發布的包裝箱而不是定義自己的版本。 `rustc`編譯器有一些可插入的操作,也就是說,功能不是硬編碼進語言的,而是在庫中實現的,通過一個特殊的標記告訴編譯器它存在。這個標記是`#[lang="..."]`屬性并且有不同的值`...`,也就是不同的“語言項”。 例如,`Box`指針需要兩個語言項,一個用于分配,一個用于釋放。下面是一個獨立的程序使用`Box`語法糖進行動態分配,通過`malloc`和`free`: ~~~ #![feature(lang_items, box_syntax, start, no_std, libc)] #![no_std] extern crate libc; extern { fn abort() -> !; } #[lang = "owned_box"] pub struct Box<T>(*mut T); #[lang="exchange_malloc"] unsafe fn allocate(size: usize, _align: usize) -> *mut u8 { let p = libc::malloc(size as libc::size_t) as *mut u8; // malloc failed if p as usize == 0 { abort(); } p } #[lang="exchange_free"] unsafe fn deallocate(ptr: *mut u8, _size: usize, _align: usize) { libc::free(ptr as *mut libc::c_void) } #[start] fn main(argc: isize, argv: *const *const u8) -> isize { let x = box 1; 0 } #[lang = "stack_exhausted"] extern fn stack_exhausted() {} #[lang = "eh_personality"] extern fn eh_personality() {} #[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} } ~~~ 注意`abort`的使用:`exchange_malloc`語言項假設返回一個有效的指針,所以需要在內部進行檢查。 其它語言項提供的功能包括: * 通過特性重載運算符:`==`,`<`,解引用(`*`)和`+`等運算符對應的特性都有語言項標記;上面4個分別為`eq`,`ord`,`deref`和`add` * 棧展開和一般故障:`eh_personality`,`fail`和`fail_bounds_checks`語言項 * `std::marker`中用來標明不同類型的特性:`send`,`sync`和`copy`。 * `std::marker`中的標記類型和變化指示器:`covariant_type`和`contravariant_lifetime`等 語言項由編譯器延時加載;例如,如果你從未用過`Box`則就沒有必要定義`exchange_malloc`和`exchange_free`的函數。`rustc`在一個項被需要而無法在當前包裝箱或任何依賴中找到時生成一個錯誤。
                  <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>

                              哎呀哎呀视频在线观看