logo
  • 教程列表
  • SO官方文檔
  • 全域性
    • 常量
    • 靜態的
    • 懶惰的
    • 執行緒區域性物件
    • 使用 mut static 的安全靜態 mut
  1. StackOverflow 文件
  2. Rust 教程
  3. 全域性
  4. 常量

常量

Created: November-22, 2018

const 關鍵字宣告瞭一個全域性常量繫結。

const DEADBEEF: u64 = 0xDEADBEEF;

fn main() {
    println("{:X}", DEADBEEF);
}

這輸出

DEADBEEF
  • 靜態的
  • 全域性

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明