magiclen / base64-url

Base64 encode, decode, escape and unescape for URL applications.
MIT License
11 stars 0 forks source link

decode_to_slice requires a global_allocator to be configured #5

Open leighmcculloch opened 1 year ago

leighmcculloch commented 1 year ago

I'm using v2.0.0, with the following Cargo.toml config:

[dependencies]
base64-url = {version= "2.0.0", default-features = false}

And the code is using this one function:

base64_url::decode_to_slice(...)

When I use this in a build that has no global_allocator, I see the following error:

error: no global memory allocator found but one is required; link to std or add `#[global_allocator]` to a static item that implements the GlobalAlloc trait
magiclen commented 9 months ago

The alloc feature of the base64 crate is always enabled. You can try to use the base64 crate directly without activate the alloc feature.

base64::engine::general_purpose::URL_SAFE_NO_PAD.decode_slice(input, output)