continuation

Crates.iocontinuation
lib.rscontinuation
version0.1.1
sourcesrc
created_at2020-12-20 23:46:52.642353
updated_at2020-12-21 01:11:26.074681
descriptionExperimental `catch_unwind`-based continuations
homepage
repositoryhttps://github.com/gefjon/continuation
max_upload_size
id325035
size13,978
Phoebe Goldman (gefjon)

documentation

README

Continuation

Pure safe Rust implementations of continuation-based control flow

This crate exports two functions, call_with_repeat_continuation and call_with_escape_continuation. The former behaves similarly to C's setjmp/longjmp, and the latter gives access to C++-style exceptions within a local scope.

Why?

Honestly, I wanted to see if this was possible in safe Rust. It turns out, in the presence of std and panic = "unwind", it is, by using catch_unwind and resume_unwind! As per The Rustonomicon, unwinding via the panic mechanism is likely to be wildly inefficient compared to exceptions in languages like C++ or Java. As a result, this crate is not suitable for high-performance use, and is frankly not useful for anything in particular. It's kinda cool, though.

License

This code is released under the MIT license, as it appears in LICENSE.md or at the Open Source Initiative. In my mind, that means I don't care what you do with the code and that I don't have any obligation to support you in so doing. That said, if you do something cool, I'd love to hear about it!

Commit count: 10

cargo fmt