File tree Expand file tree Collapse file tree 3 files changed +20
-5
lines changed Expand file tree Collapse file tree 3 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,12 @@ description = "ewasm API for Rust"
88edition = " 2018"
99
1010[dependencies ]
11- wee_alloc = " 0.4.4"
11+ cfg-if = " 0.1.7"
12+ wee_alloc = { version = " 0.4.4" , optional = true }
13+ qimalloc = { version = " 0.1" , optional = true }
1214
1315[features ]
14- default = [ " std" ]
16+ default = [" std" , " wee_alloc " ]
1517std = []
1618debug = []
1719experimental = []
Original file line number Diff line number Diff line change 3434 cargo build --release --no-default-features --features experimental
3535 cargo build --release --features experimental,debug
3636 cargo build --release --no-default-features --features experimental,debug
37+ cargo build --release --features wee_alloc
38+ cargo build --release --features qimalloc
Original file line number Diff line number Diff line change 1919/// finish_data(&a.bytes);
2020/// }
2121/// ```
22- extern crate wee_alloc;
2322
24- #[ global_allocator]
25- static ALLOC : wee_alloc:: WeeAlloc = wee_alloc:: WeeAlloc :: INIT ;
23+ #[ macro_use]
24+ extern crate cfg_if;
25+
26+ cfg_if ! {
27+ if #[ cfg( feature = "wee_alloc" ) ] {
28+ extern crate wee_alloc;
29+ #[ global_allocator]
30+ static ALLOC : wee_alloc:: WeeAlloc = wee_alloc:: WeeAlloc :: INIT ;
31+ } else if #[ cfg( feature = "qimalloc" ) ] {
32+ extern crate qimalloc;
33+ #[ global_allocator]
34+ static ALLOC : qimalloc:: QIMalloc = qimalloc:: QIMalloc :: INIT ;
35+ }
36+ }
2637
2738mod native;
2839pub mod types;
You can’t perform that action at this time.
0 commit comments