-
Notifications
You must be signed in to change notification settings - Fork 189
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
Add vec macros #438
base: main
Are you sure you want to change the base?
Add vec macros #438
Conversation
/// array. | ||
/// | ||
/// The length of the provided array must be `N`. | ||
pub fn from_array_same_cap(src: [T; N]) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
N
can be constructed in the macro, so this isn't needed.
I think instead of vec![1, 2, 3] // Vec::<_, 3>::from([1, 2, 3])
vec![1; 3] // Vec::<_, 3>::from([1; 3])
vec![1, 2, 3; 6] // Vec::<_, 6>::from([1, 2, 3])
vec![1; 3; 6] // Vec::<_, 6>::from([1; 3]) would work. |
That's ambiguous though in the case of |
Good point. In that case, maybe Then again, I think let vec: Vec<_, 6> = vec![1; 3]; should work when using |
If we don't go with the |
Add
vec
andvec_with_cap
macrosResolves #344