Created
April 5, 2016 09:25
-
-
Save anonymous/236158b5e9073195a5bec65343fd828a to your computer and use it in GitHub Desktop.
Shared via Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::path::{PathBuf ,Path}; | |
use std::env; | |
use std::fmt; | |
lazy_static! { | |
pub static ref HOME: PathBuf = get_home(); | |
} | |
pub fn get_home() -> PathBuf { | |
// mockup | |
PathBuf::from("/home/myuser") | |
} | |
pub struct Params<'a> { | |
pub home : &'a HOME, | |
pub dbs : Vec<String>, | |
/* some more fields | |
*/ | |
} | |
pub fn setup_parms(home: &HOME ) -> Params { | |
let p = Params { | |
home: &home, | |
dbs: vec!["jasd".to_string(),"asdf".to_string()], | |
}; | |
p | |
} | |
lazy_static! { | |
pub static ref PARAMETER: Params<'static> = setup_parms(&HOME); | |
} | |
impl fmt::Debug for PARAMETER { | |
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | |
write!(f, "{}", self.home.to_str()); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment