Bumps [syn](https://github.com/dtolnay/syn) from 2.0.14 to 2.0.15.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/dtolnay/syn/releases">syn's releases</a>.</em></p>
<blockquote>
<h2>2.0.15</h2>
<ul>
<li>Ensure <code>Type::Tuple</code> of length 1 prints as a tuple even if trailing comma is not provided in the Punctuated (<a href="https://redirect.github.com/dtolnay/syn/issues/1444">#1444</a>, thanks <a href="https://github.com/Fancyflame"><code>@Fancyflame</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="3da56a712a"><code>3da56a7</code></a> Release 2.0.15</li>
<li><a href="2b7ba23559"><code>2b7ba23</code></a> Merge pull request <a href="https://redirect.github.com/dtolnay/syn/issues/1444">#1444</a> from Fancyflame/master</li>
<li><a href="03e4f217bd"><code>03e4f21</code></a> fix TypeTuple::to_tokens may result in TypeParen</li>
<li><a href="0f78bdf2eb"><code>0f78bdf</code></a> Update test suite to nightly-2023-04-13</li>
<li><a href="6536786900"><code>6536786</code></a> Ignore unnecessary_box_returns pedantic clippy lint</li>
<li>See full diff in <a href="https://github.com/dtolnay/syn/compare/2.0.14...2.0.15">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=syn&package-manager=cargo&previous-version=2.0.14&new-version=2.0.15)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.13 to 2.0.14.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/dtolnay/syn/releases">syn's releases</a>.</em></p>
<blockquote>
<h2>2.0.14</h2>
<ul>
<li>Add Punctuated::pop_punct() (<a href="https://redirect.github.com/dtolnay/syn/issues/1442">#1442</a>, thanks <a href="https://github.com/programmerjake"><code>@programmerjake</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="23686e408a"><code>23686e4</code></a> Release 2.0.14</li>
<li><a href="ed15fda5e8"><code>ed15fda</code></a> Merge pull request <a href="https://redirect.github.com/dtolnay/syn/issues/1442">#1442</a> from programmerjake/add-pop-punct</li>
<li><a href="81c503550e"><code>81c5035</code></a> add Punctuated::pop_punct()</li>
<li><a href="2dc79880cd"><code>2dc7988</code></a> Update test suite to nightly-2023-04-05</li>
<li><a href="1c1c2f074f"><code>1c1c2f0</code></a> Release syn-codegen 0.3.1</li>
<li><a href="97e79f52c8"><code>97e79f5</code></a> Fix html_root_url of syn-codegen crate</li>
<li><a href="fe5e16247f"><code>fe5e162</code></a> Merge pull request <a href="https://redirect.github.com/dtolnay/syn/issues/1440">#1440</a> from dtolnay/indexmap</li>
<li><a href="f761f2480d"><code>f761f24</code></a> Force indexmap std support</li>
<li>See full diff in <a href="https://github.com/dtolnay/syn/compare/2.0.13...2.0.14">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=syn&package-manager=cargo&previous-version=2.0.13&new-version=2.0.14)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.12 to 2.0.13.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/dtolnay/syn/releases">syn's releases</a>.</em></p>
<blockquote>
<h2>2.0.13</h2>
<ul>
<li>Improve spans of Expr::Field parsed from a float Literal (<a href="https://redirect.github.com/dtolnay/syn/issues/1433">#1433</a>, <a href="https://redirect.github.com/dtolnay/syn/issues/1436">#1436</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="ac5f15d09a"><code>ac5f15d</code></a> Release 2.0.13</li>
<li><a href="856c5ddcf0"><code>856c5dd</code></a> Pull in proc-macro2 1.0.55's Literal span fixes</li>
<li><a href="9aae2b459c"><code>9aae2b4</code></a> Merge pull request <a href="https://redirect.github.com/dtolnay/syn/issues/1436">#1436</a> from dtolnay/floatsubspan</li>
<li><a href="b0861b99a1"><code>b0861b9</code></a> Ignore range_plus_one pedantic clippy lint</li>
<li><a href="3b7c555397"><code>3b7c555</code></a> Improve spans of Expr::Field parsed from a float Literal</li>
<li><a href="b80c69ac13"><code>b80c69a</code></a> Link to issues tracking unimplemented syntax</li>
<li><a href="80d4248765"><code>80d4248</code></a> Improve stderr filtering to handle compiletest's "revisions" mechanism</li>
<li><a href="c001c26595"><code>c001c26</code></a> Pass only .rs file paths to for_each_rust_file closure</li>
<li><a href="f7b4ef3608"><code>f7b4ef3</code></a> Share repo walkdir logic between the 2 repo walk tests</li>
<li><a href="ced12d42f7"><code>ced12d4</code></a> Update "rust" repo benchmark to parse compiler and standard library only</li>
<li>Additional commits viewable in <a href="https://github.com/dtolnay/syn/compare/2.0.12...2.0.13">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=syn&package-manager=cargo&previous-version=2.0.12&new-version=2.0.13)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.11 to 2.0.12.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/dtolnay/syn/releases">syn's releases</a>.</em></p>
<blockquote>
<h2>2.0.12</h2>
<ul>
<li>Refer to <code>compile_error!</code> by absolute path in token stream produced by syn::Error::to_compile_error (<a href="https://redirect.github.com/dtolnay/syn/issues/1431">#1431</a>, thanks <a href="https://github.com/smoelius"><code>@smoelius</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="42e86861c5"><code>42e8686</code></a> Release 2.0.12</li>
<li><a href="cc7cf9914e"><code>cc7cf99</code></a> Absolute path to refer to core crate in compile_error expansion</li>
<li><a href="4d1fd26229"><code>4d1fd26</code></a> Merge pull request 1431 from smoelius/compile-error</li>
<li><a href="07601a83cc"><code>07601a8</code></a> Use <code>core</code> instead of <code>std</code></li>
<li><a href="710908453b"><code>7109084</code></a> Qualify <code>compile_error!</code></li>
<li>See full diff in <a href="https://github.com/dtolnay/syn/compare/2.0.11...2.0.12">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=syn&package-manager=cargo&previous-version=2.0.11&new-version=2.0.12)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
This Pull Request closes#1975. It's still a work in progress, but tries to go in that direction.
It changes the following:
- Adds a new `TryFromJs` trait, that can be derived using a new `boa_derive` crate.
- Adds a new `try_js_into()` function that, similarly to the standard library `TryInto` trait
Things to think about:
- Should the `boa_derive` crate be re-exported in `boa_engine` using a `derive` feature, similar to how it's done in `serde`?
- The current implementation only converts perfectly valid values. So, if we try to convert a big integer into an `i8`, or any floating point number to an `f32`. So, you cannot derive `TryFromJs` for structures that contain an `f32` for example (you can still manually implement the trait, though, and decide in favour of a loss of precision). Should we also provide some traits for transparent loss of precision?
- Currently, you cannot convert between types, so if the JS struct has an integer, you cannot cast it to a boolean, for example. Should we provide a `TryConvertJs` trait, for example to force conversions?
- Currently we only have basic types and object conversions. Should add `Array` to `Vec` conversion, for example, right? Should we also add `TypedArray` conversions? What about `Map` and `Set`? Does this step over the fine grained APIs that we were creating?
Note that this still requires a bunch of documentation, tests, and validation from the dev team and from the users that requested this feature. I'm particularly interested in @lastmjs's thoughts on this API.
I already added an usage example in `boa_examples/src/bin/derive.rs`.
Co-authored-by: jedel1043 <jedel0124@gmail.com>