Implement readonly struct fields

Add support for `#[wasm_bindgen(readonly)]` which indicates that an exported
struct field is readonly and attempting to set it in JS will throw an exception.

Closes #151
This commit is contained in:
Alex Crichton
2018-04-20 10:56:10 -07:00
parent 3b4bf475be
commit 7108206835
6 changed files with 103 additions and 22 deletions

View File

@ -1,7 +1,7 @@
#[macro_use]
extern crate serde_derive;
pub const SCHEMA_VERSION: &str = "3";
pub const SCHEMA_VERSION: &str = "4";
#[derive(Deserialize)]
pub struct ProgramOnlySchema {
@ -91,6 +91,7 @@ pub struct Struct {
#[derive(Deserialize, Serialize)]
pub struct StructField {
pub name: String,
pub readonly: bool,
}
pub fn new_function(struct_name: &str) -> String {