{#-
The parameter is a borrow on purpose: wasm-bindgen lowers a by-value exported-struct argument
through `__destroy_into_raw()`, which kills the handle the caller assigned (alef#470, #473). Do
not "fix" the `get x(): T | undefined` / `set x(value: T)` asymmetry this produces for an
optional field by reverting to by-value -- the asymmetry is inherent to borrowing on set
(`Option<&T>` has no `OptionFromWasmAbi` impl) and TypeScript accepts it from 5.1 on. Clearing
an optional field is restored by the companion `clear{Field}()` in gen_class_field_clear.jinja.
`setter_ident` is carried separately from `field_ident` because the tagged-data-enum payload
path mints a method name the struct field name does not predict (`_0` becomes `field_0`). ~keep
-#}
#[wasm_bindgen(setter{{ js_name_attr }})]
pub fn {{ setter_ident }}(&mut self, value: &{{ class_type }}) {
self.{{ field_ident }} = {% if optional %}Some(value.clone()){% else %}value.clone(){% endif %};
}