Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TypedArray types... #144

Open
nearest-river opened this issue Jan 2, 2024 · 0 comments
Open

Support TypedArray types... #144

nearest-river opened this issue Jan 2, 2024 · 0 comments

Comments

@nearest-river
Copy link

nearest-river commented Jan 2, 2024

TypedArrays are very helpful in certain situations...
for example a Vec<i32> or a Box<[i32]> could be turned into an Int32Array which is very helpful

Rust

#[deno_bindgen]
pub fn mouse_pos(this: usize)-> Box<[i32]> {
  let this=unsafe { ..... };
  let pos=this.mouse_position();
  vec![pos.x,pos.y].into_boxed_slice()
}

denoland

export function mouse_pos(self: number|bigint): Int32Array {
  return lib.symbols.mouse_pos(self);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant