Skip to content

Instantly share code, notes, and snippets.

@danii
Created November 22, 2021 23:53
Show Gist options
  • Save danii/9827e1261ebff984fd9145870b4cb165 to your computer and use it in GitHub Desktop.
Save danii/9827e1261ebff984fd9145870b4cb165 to your computer and use it in GitHub Desktop.
iter! Macro
use std::iter::{empty, once};
macro_rules! iter {
() => {empty()};
($first:expr $(, $($rest:expr),*)?) => {
once($first).chain(iter![$($($rest),*)?])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment