Commit 884ad742beb93bd432c012bed6e08fc2a3432c25
1 parent
ebb7d1db
Use wee-alloc as default allocator when feature is used
Showing
1 changed file
with
8 additions
and
0 deletions
| ... | ... | @@ -4,6 +4,14 @@ mod error; |
| 4 | 4 | mod client; |
| 5 | 5 | mod component; |
| 6 | 6 | |
| 7 | +use cfg_if::cfg_if; | |
| 8 | +cfg_if! { | |
| 9 | + if #[cfg(feature = "wee_alloc")] { | |
| 10 | + #[global_allocator] | |
| 11 | + static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; | |
| 12 | + } | |
| 13 | +} | |
| 14 | + | |
| 7 | 15 | #[cfg(feature = "console_error_panic_hook")] |
| 8 | 16 | use std::panic; |
| 9 | 17 | ... | ... |
Please
register
or
login
to post a comment