wasm-bindgen icon indicating copy to clipboard operation
wasm-bindgen copied to clipboard

how to support Vec<f32>

Open nczsl opened this issue 3 years ago • 4 comments

Describe the Bug

the trait bound Vec<f32>: RefFromWasmAbi is not satisfied the trait RefFromWasmAbi is not implemented for Vec<f32>rustcE0277 the trait bound Vec<f32>: RefMutFromWasmAbi is not satisfied the trait RefMutFromWasmAbi is not implemented for A clear and concise description of what the bug is.

Steps to Reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

If applicable, add a link to a test case (as a zip file or link to a repository we can clone).

Expected Behavior

A clear and concise description of what you expected to happen.

Actual Behavior

A clear and concise description of what actually happened.

If applicable, add screenshots to help explain your problem.

Additional Context

Add any other context about the problem here.

nczsl avatar Apr 15 '22 02:04 nczsl

Is there a reason you can't use f64 and later convert it to f32 (if really needed)

ranile avatar Apr 15 '22 10:04 ranile

With a vector of million of points, you probably don't want to use twice the memory.

vallsv avatar Aug 15 '22 16:08 vallsv

Both &[f32] and Vec<f32> can be used as arguments, but not &Vec<f32>, which is what you seem to be trying to do. Using &[f32] or Vec<f32> instead should work.

Liamolucko avatar Aug 15 '22 19:08 Liamolucko

Thx for the hint.

I think i am using a *f32 + unsafe block now, ill make a second try with a Vec then.

vallsv avatar Aug 16 '22 11:08 vallsv