sunface/codecc

[文章][2022-04-14] Rust 全局变量揭秘

Closed this issue · 4 comments

原文标题: Rust global variables demystified

原文链接: https://morestina.net/blog/1774/rust-global-variables-demystified

译文链接:


选题者须知

  1. 修改 issue 标题:将 类型 修改为为 文章系列书籍 中的一个,并将 日期标题 进行替换
  2. 将上面的原文标题、原文链接和下面声明模版中的 原文链接选题 替换成相应的内容

翻译者须知

  1. 在issue中评论:申请翻译,并附上预期完成时间,等待一个 approver 来处理
  2. 请翻译者在翻译后,将声明模版的 Markdown 文本加入到文章的 顶部

声明模版

> *本文选自 [Rust 翻译计划](https://rustt.org),由 [StudyRust](https://studyrust.org) 荣誉推出*
> 
> **翻译:_该部分由 Approver 替换填写_**
> 选题:[trdthg](https://github.com/trdthg)
>
> 原文链接: https://morestina.net/blog/1774/rust-global-variables-demystified

感觉 全局变量 里已经覆盖的差不多了 😁

有没有没覆盖的,我补充下 @.@

里面着重强调了下为什么 static LOG_FILE: Mutex<String> = Mutex::new(String::new()); 编译不过。

还有就是直接用的 static LOG_FILE_ONCE: Once = Once::new(); 做演示,不过问题不大。应该不用补充

挺好的~~我吸收下,补充到书中 😆