book icon indicating copy to clipboard operation
book copied to clipboard

Additional clarity would be helpful in section 4.4 defining the Universe struct

Open apc518 opened this issue 4 years ago • 1 comments

Along with several other people, I at first missed the #[wasm_bindgen] decorator above the definition of the Universe struct, and then encountered a very confusing error on the #[wasm_bingen] decorator above the impl Universe block for the public functions.

I propose a change to 4.4 rust implementation that looks something like this

image

Where before it simply said this image

I am not sure of exactly the right thing to say there, so "We also need to let wasm_bindgen know about this struct so we'll again include the decorator" is just a placeholder. But something like it, I think, would be helpful and save a few people a headache.

apc518 avatar Nov 17 '21 22:11 apc518

@apc518 I also ran into this issue, and think that your changes would be a nice improvement.

Additionally, we may want to add the #[wasm_bindgen] decorator above the first impl Universe block. As using this as a starting point is where I first missed the decorator.

image

cmpadden avatar Mar 24 '22 15:03 cmpadden