mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-11-25 09:02:46 +03:00
Add some notes about impl details of objects
This commit is contained in:
parent
597fd98744
commit
db37034d11
@ -341,6 +341,7 @@ macro itself. Arguments allowed are:
|
||||
* Owned strings (`String`)
|
||||
* Owned structs (`Foo`) defined in the same bindgen macro
|
||||
* Borrowed structs (`&Foo` or `&mut Bar`) defined in the same bindgen macro
|
||||
* The `JsObject` type and `&JsObject` (not mutable references)
|
||||
|
||||
All of the above can also be returned except borrowed references. Strings are
|
||||
implemented with shim functions to copy data in/out of the Rust heap. That is, a
|
||||
@ -353,6 +354,10 @@ pointer. The pointer is to have a defined ABI, and the `RefCell` is to ensure
|
||||
safety with reentrancy and aliasing in JS. In general you shouldn't see
|
||||
`RefCell` panics with normal usage.
|
||||
|
||||
JS-values-in-Rust are implemented through indexes that index a table generated
|
||||
as part of the JS bindings. This table is managed via the ownership specified in
|
||||
Rust and through the bindings that we're returning.
|
||||
|
||||
All of these constructs currently create relatively straightforward code on the
|
||||
JS side of things, mostly haveing a 1:1 match in Rust with JS.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user