-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
The include-flate crate is great and would be super useful for WASM apps and libraries. It would be a way to include data files that WASM couldn't otherwise upload.
It's possible that you can make it compatible just by changing some ::std's to ::alloc's.
When I expand the flate! macro on my I get code like this (noticed the ::std's)
struct NAME_TO_PROB_STR {
__private_field: (),
}
#[doc(hidden)]
static NAME_TO_PROB_STR: NAME_TO_PROB_STR = NAME_TO_PROB_STR {
__private_field: (),
};
impl ::lazy_static::__Deref for NAME_TO_PROB_STR {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
#[inline(always)]
fn __static_ref_initialize() -> ::std::string::String {
::include_flate::decode_string(
b"\x05\xc0;\n\x00 \x08\x00\xd0Y\xc1\xa3\x14.\xd1l\xd0A\x14\x1a\x84~DK\xb7\xefM\x1d\r\xf6Y\xa6\xe6\xdd\xef#\x14)\x90\"s\r\x9c\t?",
)
}
#[inline(always)]
fn __stability() -> &'static ::std::string::String {
static LAZY: ::lazy_static::lazy::Lazy<::std::string::String> = ::lazy_static::lazy::Lazy::INIT;
LAZY.get(__static_ref_initialize)
}
__stability()
}
}
impl ::lazy_static::LazyStatic for NAME_TO_PROB_STR {
fn initialize(lazy: &Self) {
let _ = &**lazy;
}
}
This works if I manually change the ::std's to ::alloc's. You use lazy_static which says that it is 'no_std' compatible, so it should be able to work with WASM.
Thanks for considering adding this capability.
- Carl
p.s. I recently converted one of my non-macro crates to WASM and no_std compatibility and wrote a blog post about the process that you might find interesting. Thanks again for creating this crate. It did just want I needed.
SOF3
Metadata
Metadata
Assignees
Labels
No labels