我是Rust编程的新手,也是关于生命周期的学习.
const CONST_MEEP: &str = "MEEP";
const CONST_LIFETIME_MEEP: &'static str = "MEEP";
static STATIC_MEEP: &'static str = "MEEP";
static STATIC_LIFETIME_MEEP: &str = "MEEP";
fn main() {
println!("CONST_MEEP is {}", CONST_MEEP);
println!("CONST_LIFETIME_MEEP is {}", CONST_LIFETIME_MEEP);
println!("STATIC_MEEP is {}", STATIC_MEEP);
println!("STATIC_LIFETIME_MEEP is {}", STATIC_LIFETIME_MEEP);
}
Run Code Online (Sandbox Code Playgroud)
输出:
CONST_MEEP is MEEP
CONST_LIFETIME_MEEP is MEEP
STATIC_MEEP is MEEP
STATIC_LIFETIME_MEEP is MEEP
Run Code Online (Sandbox Code Playgroud)
CONST_MEEP和之间有什么区别CONST_LIFETIME_MEEP?STATIC_MEEP和之间有什么区别STATIC_LIFETIME_MEEP?
| 归档时间: |
|
| 查看次数: |
562 次 |
| 最近记录: |