Skip to content

Instantly share code, notes, and snippets.

@alicemaz
Last active November 27, 2015 16:10
Show Gist options
  • Save alicemaz/1ff721ef1b252366dc19 to your computer and use it in GitHub Desktop.
Save alicemaz/1ff721ef1b252366dc19 to your computer and use it in GitHub Desktop.
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();
}
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