Skip to content

Instantly share code, notes, and snippets.

@msullivan
Created July 19, 2013 23:21
Show Gist options
  • Save msullivan/6043069 to your computer and use it in GitHub Desktop.
Save msullivan/6043069 to your computer and use it in GitHub Desktop.
struct Command<'self> {
cmd: &'self str,
usage_line: &'self str,
}
static COMMANDS: &'static [Command<'static>] = &[
Command{
cmd: "build",
usage_line: "compile rust source files",
}
];
fn find_cmd(command_string: &str) -> Option<Command> {
do COMMANDS.iter().find_ |command| {
command.cmd == command_string
}.map_consume(|x| *x)
}
fn main() { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment