Skip to content

Instantly share code, notes, and snippets.

@sinkuu
Last active September 25, 2016 07:13
Show Gist options
  • Select an option

  • Save sinkuu/eba0120fe4c6593eb69ec86231822682 to your computer and use it in GitHub Desktop.

Select an option

Save sinkuu/eba0120fe4c6593eb69ec86231822682 to your computer and use it in GitHub Desktop.
macro_rules! while_iter_ok {
($it:expr, |$x:pat| $f:expr) => {
for x in $it {
let $x = try!(x);
$f;
}
};
($it:expr, |_ : $t:ty| $f:expr) => {
for x in $it {
let _: $t = try!(x);
$f;
}
};
($it:expr, |$x:ident : $t:ty| $f:expr) => {
for x in $it {
let $x: $t = try!(x);
$f;
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment