Skip to content

Instantly share code, notes, and snippets.

@wunki
Created September 15, 2015 14:22
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 wunki/878c906a871831294270 to your computer and use it in GitHub Desktop.
Save wunki/878c906a871831294270 to your computer and use it in GitHub Desktop.
Minimal closure in struct
extern crate iron;
use iron::prelude::{Request};
struct Resource {
is_available: Box<Fn(Request) -> bool>,
}
fn defaultResource() -> Resource{
Resource{is_available: Box::new(|_| true )}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment