#Wasm Builder Pattern

26 messages · Page 1 of 1 (latest)

vital zenith
wary verge
vital zenith
wary verge
#

If that's the case then you'll probably be interested in pyo3

vital zenith
wary verge
vital zenith
meager plank
#

How could I make a builder pattern like in Rust so that I can use the pattern in my Javascript code ? 🤔

#

I have trouble seeing how that could be made ?

#

Because I should only return primitive types from my Wasm functions, right ?

wary verge
#

If you're using wasm_bindgen then it should be pretty straightforward

#

As in just write your regular builder and slap #[wasm_bindgen] on the type definition and the impl blocks

meager plank
#

Ohhh

#

I'll try this out tomorrow, I'm indeed using wasm_bindgen

meager plank
#

@wary verge Update : I tried to do so, unsuccessfully, saying I could not return a mutable reference in wasm

wary verge
meager plank
#

Yes, I believe so, I'm experimenting !

meager plank
#

Thanks so much

#

Have you played with js_name / optionnal param for rust exported function ?

wary verge
#

js_name sure, optional parameters not so much

meager plank
#

I thought that adding multiple js name would allow that to be done :/

#

Having multiple js_name being the same

#

But I'm looking for something that is noooot so much important

#

I'd just be great