Crates.io | forward_goto |
lib.rs | forward_goto |
version | 0.1.1 |
source | src |
created_at | 2020-06-04 21:14:37.453143 |
updated_at | 2020-06-06 09:15:14.509541 |
description | Crate bringing gotos to Rust. |
homepage | https://crates.io/crates/forward_goto |
repository | https://github.com/SrTobi/forward_goto |
max_upload_size | |
id | 250159 |
size | 39,619 |
This crate provides a sound and safe way to jump from a goto forward in the control-flow to a label.
use forward_goto::rewrite_forward_goto;
#[rewrite_forward_goto]
fn decode_msg(luck: impl Fn() -> bool, is_alan_turing: bool) {
if is_alan_turing {
forward_goto!('turing_complete);
}
println!("You'll need a lot of luck for this");
if luck() {
println!("Seems you were lucky");
forward_label!('turing_complete);
println!("Message decoded!");
} else {
println!("No luck today...");
}
}
Probably not!