#clucompany #macro #no-std #goto-macro

no-std goto

A safe but not complete implementation of the goto operator

2 releases

0.1.2 Oct 19, 2019
0.1.1 Oct 17, 2019

#2631 in Development tools


Used in macro_tt_utils

MIT/Apache

9KB
84 lines

Goto

A safe but not complete implementation of the goto operator.

Build Status Mit/Apache licensed Documentation

Attention!!

  1. At the moment, this is not a complete implementation of the goto operator.
  2. We do not plan to violate Rust's safety standards. We provide useful and interesting macros that partially (or fully) implement the goto operator.

gpoint:

"GOTO point", allows you to return to this line later.

#[macro_use]
extern crate goto;

fn main() {
	let data = b"1234567890";
	let mut iter = data.iter();
	let mut a;

	gpoint!['begin:
		a = iter.next();
		match a {
			a @ Some(b'0') if a == Some(&b'9') => {
				println!("#a 0!");
				
				gpoint!['add:
					
				];
			},
			Some(a) => {
				println!("#a {}", unsafe { std::char::from_u32_unchecked(*a as u32) });
				continue 'begin;
			},
			_ => break 'begin,
		}
		
	];
}

License

Copyright 2019 #UlinProject (Denis Kotlyarov) Денис Котляров

Licensed under the MIT License

Licensed under the Apache License, Version 2.0

No runtime deps