Skip to content

Instantly share code, notes, and snippets.

@abhijat
Created December 2, 2018 16:31
Show Gist options
  • Select an option

  • Save abhijat/a91eb9bd0108909c81ed3157cd3c785c to your computer and use it in GitHub Desktop.

Select an option

Save abhijat/a91eb9bd0108909c81ed3157cd3c785c to your computer and use it in GitHub Desktop.
struct Node {
host_name: String,
is_master: bool,
}
enum ParserResponse {
ParseError(usize, usize),
AddNodeCommand(String, bool),
RemoveNodeCommand(Node)
}
match parser_response {
ParseError(line_num, col_num) => handle_parse_error(line_num, col_num),
AddNodeCommand(host_name, is_master) => add_new_node(host_name, is_master),
RemoveNodeCommand(node_to_remove) => remove_node(node_to_remove),
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment