Alex Crichton 4c42aba007 Switch all imports to structural by default
This commit switches all imports of JS methods to `structural` by
default. Proposed in [RFC 5] this should increase the performance of
bindings today while also providing future-proofing for possible
confusion with the recent addition of the `Deref` trait for all imported
types by default as well.

A new attribute, `host_binding`, is introduced in this PR as well to
recover the old behavior of binding directly to an imported function
which will one day be the precise function on the prototype. Eventually
`web-sys` will switcsh over entirely to being driven via `host_binding`
methods, but for now it's been measured to be not quite as fast so we're
not making that switch yet.

Note that `host_binding` differs from the proposed name of `final` due
to the controversy, and its hoped that `host_binding` is a good
middle-ground!

[RFC 5]: https://rustwasm.github.io/rfcs/005-structural-and-deref.html
2018-11-08 13:52:18 -08:00

38 lines
724 B
Rust

#![cfg(target_arch = "wasm32")]
extern crate js_sys;
extern crate wasm_bindgen;
extern crate wasm_bindgen_test;
extern crate wasm_bindgen_test_crate_a;
extern crate wasm_bindgen_test_crate_b;
#[cfg(feature = "serde-serialize")]
#[macro_use]
extern crate serde_derive;
pub mod api;
pub mod char;
pub mod classes;
pub mod closures;
pub mod comments;
pub mod duplicate_deps;
pub mod duplicates;
pub mod enums;
pub mod host_binding;
pub mod import_class;
pub mod imports;
pub mod js_objects;
pub mod jscast;
pub mod math;
pub mod node;
pub mod option;
pub mod optional_primitives;
pub mod rethrow;
pub mod simple;
pub mod slice;
pub mod structural;
pub mod u64;
pub mod validate_prt;
pub mod variadic;
pub mod vendor_prefix;