mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-25 00:00:05 +03:00
Add looks_done method to Exercise to expose a resolution state
This commit is contained in:
parent
0d65753fdb
commit
0b9220c1fc
|
@ -232,6 +232,16 @@ path = "{}.rs""#,
|
||||||
|
|
||||||
State::Pending(context)
|
State::Pending(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check that the exercise looks to be solved using self.state()
|
||||||
|
// This is not the best way to check since
|
||||||
|
// the user can just remove the "I AM NOT DONE" string fromm the file
|
||||||
|
// without actually having solved anything.
|
||||||
|
// The only other way to truly check this would to compile and run
|
||||||
|
// the exercise; which would be both costly and counterintuitive
|
||||||
|
pub fn looks_done(&self) -> bool {
|
||||||
|
self.state() == State::Done
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for Exercise {
|
impl Display for Exercise {
|
||||||
|
|
Loading…
Reference in a new issue