Created
February 15, 2016 20:43
-
-
Save adamhjk/1974b883c843fb1d5836 to your computer and use it in GitHub Desktop.
Sample of exhaustive pattern matching
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
pub fn wait_for_leader(&self) -> bool { | |
self.wait_for_it(Duration::seconds(5), || { | |
let election = self.election(); | |
match election.find_path(&["mine", "status"]) { | |
Some(status) => match status.as_string() { | |
Some("Finished") => true, | |
Some(_) => false, | |
None => false, | |
}, | |
None => false, | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment