char/avril

(wip) why'd you have to go and make things so complicaaaaated?

git clone https://git.t4t.associates/char/avril

Charlotte Somsnapshot: embed shared main and worker startup in the CLI688e96e

main
579 B15 linesraw
1use std::sync::{Arc, LazyLock};
2
3use avril_core::Snapshot;
4
5pub(crate) fn embedded() -> Arc<Snapshot> {
6    static SNAPSHOT: LazyLock<Arc<Snapshot>> = LazyLock::new(|| {
7        // SAFETY: Cargo generates this from the same core/runtime dependencies.
8        // build.rs rejects cross-target generation; no filesystem artifact is loaded at startup.
9        Arc::new(unsafe {
10            Snapshot::from_bytes(&include_bytes!(concat!(env!("OUT_DIR"), "/runtime.snapshot"))[..])
11                .expect("Invalid embedded runtime snapshot")
12        })
13    });
14    SNAPSHOT.clone()
15}