Remove wee_alloc as it's unsuitable for this use case and OOMs

This commit is contained in:
Andras Schmelczer 2025-01-03 18:21:56 +00:00
parent c0b824796f
commit 875592deda
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
3 changed files with 17 additions and 50 deletions

View file

@ -6,12 +6,6 @@ use wasm_bindgen::prelude::*;
pub mod errors;
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc<'_> = wee_alloc::WeeAlloc::INIT;
#[wasm_bindgen(js_name = bytesToBase64)]
pub fn bytes_to_base64(input: &[u8]) -> String { STANDARD_NO_PAD.encode(input) }
@ -49,7 +43,7 @@ pub fn merge_text(parent: &str, left: &str, right: &str) -> String {
}
#[wasm_bindgen(js_name = isBinary)]
pub fn is_binary(data: &[u8]) -> bool { data.iter().any(|&b| b == 0) }
pub fn is_binary(data: &[u8]) -> bool { std::str::from_utf8(data).is_ok() }
#[cfg(feature = "console_error_panic_hook")]
#[wasm_bindgen(js_name = setPanicHook)]