Skip to content

feat: Implement JSValue::new_typed_array_with_bytes #18

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 2 commits into from
Oct 5, 2023

Conversation

Hywan
Copy link
Contributor

@Hywan Hywan commented Oct 5, 2023

Built on top of #17.

This patch implements JSValue::new_typed_array_with_bytes.

This method is marked as unsafe, because bytes aren't copied: they are
borrowed mutably by JavaScript. The borrow checker cannot ensure safety.
JavaScript or Rust can concurrently access to the bytes. It's unsafe,
but it's fast.

@Hywan Hywan force-pushed the feat-jsvalue-new-typed-array branch 2 times, most recently from ab00e6e to 10d238f Compare October 5, 2023 12:26
This patch implements `JSValue::new_typed_array_with_bytes`.

This method is marked as unsafe, because bytes aren't copied: they are
borrowed mutably by JavaScript. The borrow checker cannot ensure safety.
JavaScript or Rust can concurrently access to the bytes. It's unsafe,
but it's fast.
@Hywan Hywan force-pushed the feat-jsvalue-new-typed-array branch from 10d238f to c28e727 Compare October 5, 2023 12:32
@Hywan Hywan requested a review from waywardmonkeys October 5, 2023 12:40
@waywardmonkeys waywardmonkeys merged commit f88246b into endoli:main Oct 5, 2023
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