Is there an `include_bytes!` for more complicated types

I have the wonderful type

pub struct CharTrie {
    level1: &'static [u64; 32],
    level2: &'static [u8; 992],
    level3: (&'static [u8; 256], &'static [[u8; 64]]),
    leaves: &'static [u64],

that I'd like to be able to generate and embed in a slightly more sane format than just generated Rust source code.

Ideally it'd be const-safe; if not, I'd be better off compressing it and decompressing at runtime. (Maximum size of this structure is 20KB, minimum about 2.5KB.)

If include_bytes!("..") is include_ints!(u8, ".."), I need include_ints!(u64, "..") and include_ints!([u8; 64], "..").

The closest I can think of is something like transmute(Align8(include_bytes!(".."))), but that has to consider endianness.


Previous discussion:


Ah, I knew that thread was somewhere, I'm even in it.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.