79410074

Date: 2025-02-03 21:41:35
Score: 1.5
Natty:
Report link

Okay I finally found the answer thanks to Eugene Sh.'s code:

use seq_macro::seq;

macro_rules! include_each {
    ($n:literal) => {
        seq!(N in 0..$n {
            [#(include_bytes!(stringify!(file~N)),)*]
        })
    };
}

const FRAME_SIZE: usize = 8;
static DATA: [&[u8; FRAME_SIZE]; 2] = include_each!(2);

Which I modified into this:

#[macro_export]
macro_rules! import_img_anim {
    ($path:literal, $n:literal, $extension:literal) => {
        seq_macro::seq!(N in 1..=$n {
            [#(include_bytes!(concat!($path, "/frame", stringify!(N), $extension)),)*]
        })
    };
}

The problem seemed to be this part of the code:

seq_macro::seq!(N in 1..=$n {
    include_bytes!(concat!($path, "/frame", stringify!(N), ".png")),
})

Which just put the include_bytes! macro there without anything else.

Thanks again Eugenne Sh.!

Reasons:
  • Blacklisted phrase (0.5): thanks
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Aatos Tapper