Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crate: add 'alloc' feature #127

Merged
merged 3 commits into from
Jul 11, 2023
Merged

crate: add 'alloc' feature #127

merged 3 commits into from
Jul 11, 2023

Conversation

BurntSushi
Copy link
Owner

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

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
Lucretiel and others added 2 commits July 10, 2023 23:15
Basically, use `?` to pretty massively simplify `next`. And also add a
`size_hint` method based on some sensible constraints.

Closes #123
This permits one to run the AVX memchr routines on x86-64 even when
'std' is not enabled. Probably something similar should be done for
memmem, but I think I have to insist on its conditional compilation
being simplified/centralized first.

Closes #120
@BurntSushi
Copy link
Owner Author

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

@BurntSushi BurntSushi merged commit 54c8931 into master Jul 11, 2023
13 checks passed
@BurntSushi BurntSushi deleted the ag/add-alloc branch July 11, 2023 03:29
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.

Feature request: no-std + alloc
3 participants