Last active
August 29, 2015 14:13
-
-
Save drbawb/6bbea20b5cf5d75a4680 to your computer and use it in GitHub Desktop.
fn-ptr not `Clone` workaround
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
#[derive(Clone)] | |
pub struct Expression { | |
names: Vec<String>, | |
regex: Regex, | |
} | |
pub type Handler = fn(req: &Request, env: &mut Env) -> Result<String,String>; | |
pub struct Route { | |
matcher: Expression, | |
handler: Handler, | |
} | |
impl Clone for Route { | |
fn clone(&self) -> Route { | |
Route { | |
matcher: self.matcher.clone(), | |
handler: self.handler, | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment