use unwinding for cancelation

This commit is contained in:
Aleksey Kladov 2019-01-10 12:20:32 +03:00
parent cf20ecae9f
commit 64455ad701
6 changed files with 61 additions and 43 deletions

View file

@ -27,6 +27,10 @@ impl Canceled {
pub(crate) fn new() -> Canceled {
Canceled { _private: () }
}
pub fn throw() -> ! {
std::panic::resume_unwind(Box::new(Canceled::new()))
}
}
impl std::fmt::Display for Canceled {