Skip to content

Instantly share code, notes, and snippets.

@n3r0bi0m4n
Last active August 8, 2023 21:24
Show Gist options
  • Select an option

  • Save n3r0bi0m4n/73d713506383ee8e1d0c2fa87153be96 to your computer and use it in GitHub Desktop.

Select an option

Save n3r0bi0m4n/73d713506383ee8e1d0c2fa87153be96 to your computer and use it in GitHub Desktop.
Rust Array macro
macro_rules! Array {
($n:expr, $t:ty) => (std::array::from_fn::<$t, $n, _>(|_| <$t>::default()));
($n:expr, $f:expr) => (std::array::from_fn::<_, $n, _>($f));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment