Last active
August 8, 2023 21:24
-
-
Save n3r0bi0m4n/73d713506383ee8e1d0c2fa87153be96 to your computer and use it in GitHub Desktop.
Rust Array macro
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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