Created
September 19, 2024 20:07
-
-
Save a10y/1a4c0b90428566e7f929e0d8f56d58e1 to your computer and use it in GitHub Desktop.
This file contains 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! make_encoding_ids_rec { | |
($count:expr) => {}; | |
($count:expr, $encoding:ident $($tts:tt)*) => { | |
pub const $encoding: u16 = $count; | |
make_encoding_ids_rec!(($count+1u16) $($tts)*); | |
} | |
} | |
macro_rules! make_encoding_ids { | |
($($encodings:ident),*) => { | |
make_encoding_ids_rec!(1u16 $(, $encodings)*); | |
}; | |
} | |
make_encoding_ids! { | |
FIRST | |
, SECOND | |
, THIRD | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment