Last active
November 27, 2015 16:10
-
-
Save alicemaz/1ff721ef1b252366dc19 to your computer and use it in GitHub Desktop.
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
mod twot { | |
pub struct Config<'a> { | |
key: &'a str, | |
secret: &'a str, | |
token: &'a str, | |
token_secret: &'a str | |
} | |
impl<'a> Config<'a> { | |
pub fn new(key: &'a str, sec: &'a str, tok: &'a str, tok_sec: &'a str) -> Config<'a> { | |
Config { | |
key: key, | |
secret: sec, | |
token: tok, | |
token_secret: tok_sec | |
} | |
} | |
pub fn test(&self) { | |
println!("test {}", self.key); | |
} | |
} | |
} | |
fn main() { | |
//in real code, read these from disk/envs | |
let key = "lol"; | |
let sec = "hi"; | |
let tok = "wat"; | |
let tok_sec = "bye"; | |
let twot = twot::Config::new(key, sec, tok, tok_sec); | |
twot.test(); | |
} |
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
mod twot { | |
pub struct Config { | |
key: str, | |
secret: str, | |
token: str, | |
token_secret: str | |
} | |
impl Config { | |
pub fn new(key: str, sec: str, tok: str, tok_sec: str) -> Config { | |
Config { | |
key: key, | |
secret: sec, | |
token: tok, | |
token_secret: tok_sec | |
} | |
} | |
pub fn test(&self) { | |
println!("test {}", self.key); | |
} | |
} | |
} | |
fn main() { | |
//in real code, read these from disk/envs | |
let key = "lol"; | |
let sec = "hi"; | |
let tok = "wat"; | |
let tok_sec = "bye"; | |
let twot = twot::Config::new(key, sec, tok, tok_sec); | |
twot.test(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment