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

Implement Args for Vec #147

Merged
merged 2 commits into from
Oct 11, 2020
Merged

Implement Args for Vec #147

merged 2 commits into from
Oct 11, 2020

Conversation

MinusGix
Copy link
Contributor

The first commit changes the Args::count method to take a self parameter, as the size for a Vector can not be known at compile-time like the size of tuples. Hopefully, such a change won't cause worse optimization for tuples as all Args are used as generic parameters and so are known what they are compile-time.

The second commit implements Args for a Vec<runestick::Value>, as well as adding an example of it being used. The use-case for this is when you want to pass parameters of an unknown amount into a rune function.
This could be changed to be more generic instead, such as implementing Args for Vec<T> where T: ToValue. That would include Value, and other Vectors of types which could be transformed into values. If you'd prefer, I could change the pr to implement it for T: ToValue.

@udoprog udoprog added the enhancement New feature or request label Oct 11, 2020
@udoprog
Copy link
Collaborator

udoprog commented Oct 11, 2020

This is perfect. Much appreciated!

@udoprog udoprog merged commit 767a9d6 into rune-rs:master Oct 11, 2020
@udoprog udoprog added the changelog Issue has been added to the changelog label Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog Issue has been added to the changelog enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants