add lazy_static
This commit is contained in:
10
lazy_static/Cargo.toml
Normal file
10
lazy_static/Cargo.toml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[package]
|
||||||
|
name = "lazy_static"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Hatter Jiang <jht5945@gmail.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
lazy_static = "1.4.0"
|
||||||
10
lazy_static/src/main.rs
Normal file
10
lazy_static/src/main.rs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#[macro_use]
|
||||||
|
extern crate lazy_static;
|
||||||
|
|
||||||
|
lazy_static! {
|
||||||
|
static ref USER_HOME: Option<String> = std::env::var("HOME").ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
println!("User home: {:?}", *USER_HOME);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user