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

feat(neon): Allow getting a &'cx T from a Handle<'cx, JsBox<T>> #1087

Merged
merged 2 commits into from
Jan 13, 2025

Conversation

kjvalencik
Copy link
Member

@kjvalencik kjvalencik commented Jan 10, 2025

Resolves #678

I added Handle<JsBox>::as_inner and JsBox::deref. Let me know if you have preferred names. I was trying to pick reasonable names that didn't conflict with built-in incompatible traits (e.g., AsRef).

This feature is needed for impl<'cx, T> TryFromJs<'cx> for &'cx RefCell<T> which will allow low boilerplate extractors.

@kjvalencik kjvalencik requested a review from dherman January 10, 2025 22:36
@dherman
Copy link
Collaborator

dherman commented Jan 10, 2025

I added Handle<JsBox>::as_inner and JsBox::deref.

Oh, I like these names!

Copy link
Collaborator

@dherman dherman left a comment

Choose a reason for hiding this comment

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

Love it. I left a small copy edit for the comments.

crates/neon/src/types_impl/boxed.rs Outdated Show resolved Hide resolved
@kjvalencik kjvalencik merged commit e996288 into main Jan 13, 2025
9 checks passed
@kjvalencik kjvalencik deleted the kv/jsbox-lifetime branch January 13, 2025 13:52
@dherman dherman mentioned this pull request Jan 13, 2025
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.

Handle<'a, JsBox<T>> should be able to be dereferenced to &'a T
2 participants