-
Notifications
You must be signed in to change notification settings - Fork 130
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
Use const generics in ArrayVec #172
Conversation
Just search/replace for syntax [T; N] -> T, N and it works.
With const generics we can't avoid the usize (or other type) length field.
CI passes on beta and nightly - will pass fully when Rust 1.51 is released this week. |
I am wondering if rust-lang/rust#76560 can help with the size regression introduced here in future version of |
Later PR updated the length to always be u32 (for a smaller size). I can't answer your question, maybe you know? 🙂 |
It seems so to me, but I am not terribly familiar with Rust constant generics. Will try push a pull request when it is stable! |
Use const generics for ArrayVec and ArrayString - now it can support arbitrary capacity/backing array.
Syntax changes like this:
ArrayVec<[T; CAP]>
ArrayVec<T, CAP>
ArrayString<[u8; CAP]>
ArrayString<CAP>
The
ArrayVec<T, const CAP: usize>
for now always uses anusize
for its length, and so uses more space than the oldArrayVec<[T; CAP]>
.Requires Rust 1.51 (March 2021)
In for example Vim one can use the following substitution to update syntax:
Fixes #125
Closes #100