Skip to content

Add alloc feature to support no_std without an allocator#225

Open
fbrozovic wants to merge 1 commit into
PSeitz:mainfrom
fbrozovic:alloc-feature
Open

Add alloc feature to support no_std without an allocator#225
fbrozovic wants to merge 1 commit into
PSeitz:mainfrom
fbrozovic:alloc-feature

Conversation

@fbrozovic

@fbrozovic fbrozovic commented Jun 11, 2026

Copy link
Copy Markdown

Gate the Vec-returning block APIs behind a new alloc feature, enabled by default via std. Without it only the _into variants are available; compression places its hash table on the stack, or the table can be provided via compress_into_with_table, with const constructors so it can be stored in a static.

Fixes: #220

Gate the Vec-returning block APIs behind a new alloc feature, enabled
by default via std. Without it only the _into variants are available;
compression places its hash table on the stack, or the table can be
provided via compress_into_with_table, with const constructors so it
can be stored in a static.
@PSeitz

PSeitz commented Jun 12, 2026

Copy link
Copy Markdown
Owner

What happens if there is no allocator available? Will it fail to compile or a runtime error?

@fbrozovic

Copy link
Copy Markdown
Author

The existing behavior is unchanged - the crate fails to compile if there is no allocator available and the alloc feature is enabled:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

no-std still pulls in a global allocator

2 participants