Skip to main content

pinyinchch_type/
lib.rs

1pub mod dag;
2pub mod hmm;
3
4#[macro_export]
5macro_rules! embed_data {
6    ($name:ident,$t:ty,$byte:ident,$path:literal) => {
7        pub const $byte: &'static [u8] = include_bytes!($path);
8        pub static $name: ::std::sync::LazyLock<$t> = ::std::sync::LazyLock::new(|| {
9            let mut aligned = rkyv::util::AlignedVec::<16>::new();
10            aligned.extend_from_slice($byte);
11            rkyv::from_bytes::<$t, rkyv::rancor::Error>(&aligned).expect(concat!(
12                "Failed to crate ",
13                stringify!($name),
14                ".rkyv in the path(",
15                $path,
16                ")"
17            ))
18        });
19    };
20}