pyra-tokens 0.9.3

Token definitions for supported assets on Pyra
Documentation
/// Compile-time filtering of supported tokens by a given field.
#[macro_export]
macro_rules! filter_supported_tokens {
    ($vis:vis $name:ident, $field:ident) => {
        #[allow(clippy::allow_attributes, clippy::allow_attributes_without_reason, clippy::arithmetic_side_effects)]
        $vis const $name: [Token; {
            let mut c = 0usize;
            let mut i = 0usize;
            while i < SUPPORTED_TOKENS.len() {
                if SUPPORTED_TOKENS[i].$field.is_some() { c += 1; }
                i += 1;
            }
            c
        }] = {
            const N: usize = {
                let mut c = 0usize;
                let mut i = 0usize;
                while i < SUPPORTED_TOKENS.len() {
                    if SUPPORTED_TOKENS[i].$field.is_some() { c += 1; }
                    i += 1;
                }
                c
            };
            let mut out = [SUPPORTED_TOKENS[0]; N];
            let mut j = 0usize;
            let mut i = 0usize;
            while i < SUPPORTED_TOKENS.len() {
                if SUPPORTED_TOKENS[i].$field.is_some() {
                    out[j] = SUPPORTED_TOKENS[i];
                    j += 1;
                }
                i += 1;
            }
            out
        };
    };
}