Skip to content

Instantly share code, notes, and snippets.

View BookOwl's full-sized avatar

Matthew BookOwl

  • USA
View GitHub Profile
@BookOwl
BookOwl / sequence.rs
Last active June 29, 2017 13:35 — forked from anonymous/playground.rs
A hacky sequence macro for emulating C-style for loops
macro_rules! sequence {
($x:ident : $t:ty = $init:expr ; $cond:expr ; $change:expr) => {{
struct Sequence {
val: $t,
}
impl Iterator for Sequence {
type Item = $t;
#[inline]