Skip to content

Instantly share code, notes, and snippets.

@drbawb
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drbawb/6bbea20b5cf5d75a4680 to your computer and use it in GitHub Desktop.
Save drbawb/6bbea20b5cf5d75a4680 to your computer and use it in GitHub Desktop.
fn-ptr not `Clone` workaround
#[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