Skip to content

Support closures with "rich" arguments #132

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

Merged
merged 1 commit into from
Apr 16, 2018
Merged

Conversation

alexcrichton
Copy link
Contributor

This commit adds support for closures with arguments like strings and such. In
other words, closures passed to JS can now have the same suite of arguments as
all functions that can be exported from Rust, as one might expect!

At this time due to the way trait objects work closures still cannot use types
with references like &str, but bare values like String or ImportedType
should work just fine.

Closes #104

This commit adds support for closures with arguments like strings and such. In
other words, closures passed to JS can now have the same suite of arguments as
all functions that can be exported from Rust, as one might expect!

At this time due to the way trait objects work closures still cannot use types
with references like `&str`, but bare values like `String` or `ImportedType`
should work just fine.

Closes #104
@alexcrichton alexcrichton force-pushed the closure-more-fun-types branch from bffd67b to c64f178 Compare April 16, 2018 14:52
@alexcrichton alexcrichton merged commit 1c11c46 into master Apr 16, 2018
@alexcrichton alexcrichton deleted the closure-more-fun-types branch April 16, 2018 14:52
@@ -48,7 +48,7 @@ pub enum Descriptor {
F64,
Boolean,
Function(Box<Function>),
Closure(Box<Function>),
Closure(Box<Function>, bool),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, it is time to make this a struct variant :-p

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good idea, done in f80a706

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants