-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
886: Add TryFrom to convert from Varargs to tuples r=Bromeon a=B-head This PR is stacked on `varargs_gets` branch. See #892 for details on some of the commits included in this PR. ## Feature Dirty syntax to convert to tuples. This makes manual binding easier to write than ever before. Implement via `varargs_into_tuple!()` macro. Can be converted to tuples up to 12 in length. This is the same length supported by standard library. ```rust fn call(&self, _this: TInstance<'_, Foo>, args: Varargs<'_>) -> Variant { // Convert from Varargs to tuples. let (a, b, c): (i64, i64, i64) = args.try_into().unwrap(); let ret = (a * b - c); ret.to_variant() } ``` ## Compatibility Since this PR only adds an API, there are no compatibility issues. Co-authored-by: B_head <b_head@outlook.jp> Co-authored-by: Jan Haller <bromeon@gmail.com>
- Loading branch information
Showing
2 changed files
with
402 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.