-
Notifications
You must be signed in to change notification settings - Fork 145
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
Added feature const_new
which enables SmallVec::new_const()
#265
Conversation
I added My thought was that |
Could |
Yes, that is another option that should work. It will then be added to the same place as I'll be able to push a new commit in 8 hours or so. Is there anything else I should take a look at regarding this PR? |
Limiting the const functions to |
@bors-servo r+ |
📌 Commit 8320871 has been approved by |
Added feature `const_new` which enables `SmallVec::new_const()` As I wasn't alone in finding a use for having a `const` version of `new` (see #263) I decided to make a PR for it. This adds a new feature flag `const_new` (nightly only) which exposes an alternative `new` function: `pub const unsafe fn new_const() -> SmallVec<A>`. Nightly is needed for the binding `A: Array`, which could be worked around if the strict requirement is dropped from the `struct` declarations and moved only to the existing `impl`s. If the maintainers wish for another solution for this I'll be happy to make a few more commits.
Thanks! This has been released in smallvec 1.7.0: https://crates.io/crates/smallvec/1.7.0 |
💥 Test timed out |
As I wasn't alone in finding a use for having a
const
version ofnew
(see #263) I decided to make a PR for it.This adds a new feature flag
const_new
(nightly only) which exposes an alternativenew
function:pub const unsafe fn new_const() -> SmallVec<A>
.Nightly is needed for the binding
A: Array
, which could be worked around if the strict requirement is dropped from thestruct
declarations and moved only to the existingimpl
s.If the maintainers wish for another solution for this I'll be happy to make a few more commits.