BurntSushi / memchr

Optimized string search routines for Rust.
The Unlicense
873 stars 99 forks source link

crate: add 'alloc' feature #127

Closed BurntSushi closed 1 year ago

BurntSushi commented 1 year ago

This crate currently only has a 'std' feature and of course support for no-std. But in that mode, it was also no-alloc. In practice, this crate is virtually all core-only, that is, no-std and no-alloc. There are really only a few parts that want std or alloc. For std, runtime CPU feature detection requires it. For alloc, there are a few minor APIs that require allocation.

Previously, the only way to get the APIs that require allocation was to enable 'std'. This new feature permits getting those APIs without bringing in 'std'.

I don't expect this to unlock any new or interesting use cases, but it will make downstream configurations a little more sensible and less annoying.

Fixes #121

BurntSushi commented 1 year ago

I'm also rolling #120 and #123 into this PR.